We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4dcde2f commit c98f87bCopy full SHA for c98f87b
coderd/database/migrations/000030_template_version_created_by.up.sql
@@ -1,14 +1,18 @@
1
+BEGIN;
2
+
3
ALTER TABLE ONLY template_versions ADD COLUMN IF NOT EXISTS created_by uuid REFERENCES users (id) ON DELETE RESTRICT;
4
5
UPDATE
6
template_versions
7
SET
- created_by = (
- SELECT created_by FROM templates
8
+ template_versions.created_by = (
9
+ SELECT templates.created_by FROM templates
10
WHERE template_versions.template_id = templates.id
11
LIMIT 1
12
)
13
WHERE
- created_by IS NULL;
14
+ template_versions.created_by IS NULL;
15
16
ALTER TABLE ONLY template_versions ALTER COLUMN created_by SET NOT NULL;
17
18
+COMMIT;
0 commit comments