mirror of
https://github.com/coder/coder.git
synced 2025-07-13 21:36:50 +00:00
chore: add organization_id column to provisioner daemons (#12356)
* chore: add organization_id column to provisioner daemons * Update upsert to include organization id on set
This commit is contained in:
@ -0,0 +1,2 @@
|
||||
ALTER TABLE provisioner_daemons
|
||||
DROP COLUMN organization_id;
|
14
coderd/database/migrations/000198_org_provisioners.up.sql
Normal file
14
coderd/database/migrations/000198_org_provisioners.up.sql
Normal file
@ -0,0 +1,14 @@
|
||||
-- At the time of this migration, only 1 org is expected in a deployment.
|
||||
-- In the future when multi-org is more common, there might be a use case
|
||||
-- to allow a provisioner to be associated with multiple orgs.
|
||||
ALTER TABLE provisioner_daemons
|
||||
ADD COLUMN organization_id UUID REFERENCES organizations(id) ON DELETE CASCADE;
|
||||
|
||||
UPDATE
|
||||
provisioner_daemons
|
||||
SET
|
||||
-- Default to the first org
|
||||
organization_id = (SELECT id FROM organizations WHERE is_default = true LIMIT 1 );
|
||||
|
||||
ALTER TABLE provisioner_daemons
|
||||
ALTER COLUMN organization_id SET NOT NULL;
|
Reference in New Issue
Block a user