mirror of
https://github.com/coder/coder.git
synced 2025-07-12 00:14:10 +00:00
- Add deleted column to organizations table - Add trigger to check for existing workspaces, templates, groups and members in a org before allowing the soft delete --------- Co-authored-by: Steven Masley <stevenmasley@gmail.com> Co-authored-by: Steven Masley <Emyrk@users.noreply.github.com>
13 lines
509 B
SQL
13 lines
509 B
SQL
DROP INDEX IF EXISTS idx_organization_name_lower;
|
|
|
|
CREATE UNIQUE INDEX IF NOT EXISTS idx_organization_name ON organizations USING btree (name);
|
|
CREATE UNIQUE INDEX IF NOT EXISTS idx_organization_name_lower ON organizations USING btree (lower(name));
|
|
|
|
ALTER TABLE ONLY organizations
|
|
ADD CONSTRAINT organizations_name UNIQUE (name);
|
|
|
|
DROP TRIGGER IF EXISTS protect_deleting_organizations ON organizations;
|
|
DROP FUNCTION IF EXISTS protect_deleting_organizations;
|
|
|
|
ALTER TABLE organizations DROP COLUMN deleted;
|