Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a77b930 commit 48b232dCopy full SHA for 48b232d
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