Files
coder/coderd/database/migrations/000023_template_created_by_not_null.up.sql
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

14 lines
319 B
SQL
Raw Normal View History

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;