mirror of
https://github.com/coder/coder.git
synced 2025-07-15 22:20:27 +00:00
fix: populate default created_by and add not-null constraint in templates (#2290)
This commit is contained in:
@ -0,0 +1 @@
|
||||
ALTER TABLE ONLY templates ALTER COLUMN created_by DROP NOT NULL;
|
@ -0,0 +1,14 @@
|
||||
UPDATE
|
||||
templates
|
||||
SET
|
||||
created_by = (
|
||||
SELECT user_id FROM organization_members
|
||||
WHERE organization_members.organization_id = templates.organization_id
|
||||
ORDER BY created_at
|
||||
LIMIT 1
|
||||
)
|
||||
WHERE
|
||||
created_by IS NULL;
|
||||
|
||||
|
||||
ALTER TABLE ONLY templates ALTER COLUMN created_by SET NOT NULL;
|
Reference in New Issue
Block a user