Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
ALTER TABLE organizations ADD CONSTRAINT organizations_name_key UNIQUE (name);
DROP INDEX IF EXISTS uq_organizations_name_live;

ALTER TABLE projects ADD CONSTRAINT projects_name_key UNIQUE (name);
DROP INDEX IF EXISTS uq_projects_name_live;

ALTER TABLE users ADD CONSTRAINT users_email_key UNIQUE (email);
DROP INDEX IF EXISTS uq_users_email_live;

ALTER TABLE users ADD CONSTRAINT users_name_key UNIQUE (name);
DROP INDEX IF EXISTS uq_users_name_live;

ALTER TABLE domains ADD CONSTRAINT org_id_name_unique UNIQUE (org_id, name);
DROP INDEX IF EXISTS uq_domains_org_id_name_live;

ALTER TABLE groups ADD CONSTRAINT groups_org_id_name_key UNIQUE (org_id, name);
DROP INDEX IF EXISTS uq_groups_org_id_name_live;
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
CREATE UNIQUE INDEX IF NOT EXISTS uq_organizations_name_live ON organizations (name) WHERE deleted_at IS NULL;
ALTER TABLE organizations DROP CONSTRAINT IF EXISTS organizations_name_key;

CREATE UNIQUE INDEX IF NOT EXISTS uq_projects_name_live ON projects (name) WHERE deleted_at IS NULL;
ALTER TABLE projects DROP CONSTRAINT IF EXISTS projects_name_key;

CREATE UNIQUE INDEX IF NOT EXISTS uq_users_email_live ON users (email) WHERE deleted_at IS NULL;
ALTER TABLE users DROP CONSTRAINT IF EXISTS users_email_key;

CREATE UNIQUE INDEX IF NOT EXISTS uq_users_name_live ON users (name) WHERE deleted_at IS NULL;
ALTER TABLE users DROP CONSTRAINT IF EXISTS users_name_key;

CREATE UNIQUE INDEX IF NOT EXISTS uq_domains_org_id_name_live ON domains (org_id, name) WHERE deleted_at IS NULL;
ALTER TABLE domains DROP CONSTRAINT IF EXISTS org_id_name_unique;

CREATE UNIQUE INDEX IF NOT EXISTS uq_groups_org_id_name_live ON groups (org_id, name) WHERE deleted_at IS NULL;
ALTER TABLE groups DROP CONSTRAINT IF EXISTS groups_org_id_name_key;
Loading