diff --git a/migrations/009.user-deleted.down.sql b/migrations/009.user-deleted.down.sql new file mode 100644 index 00000000..bc67ba5f --- /dev/null +++ b/migrations/009.user-deleted.down.sql @@ -0,0 +1,5 @@ +ALTER TABLE users DROP COLUMN IF EXISTS is_deleted; +ALTER TABLE users DROP COLUMN IF EXISTS deleted_on; + +DROP INDEX IF EXISTS users_username_idx; +ALTER TABLE users ADD CONSTRAINT users_username_key UNIQUE (username); \ No newline at end of file diff --git a/migrations/009.user-deleted.up.sql b/migrations/009.user-deleted.up.sql new file mode 100644 index 00000000..72c18713 --- /dev/null +++ b/migrations/009.user-deleted.up.sql @@ -0,0 +1,5 @@ +ALTER TABLE users ADD COLUMN IF NOT EXISTS is_deleted boolean NOT NULL DEFAULT(false); +ALTER TABLE users ADD COLUMN IF NOT EXISTS deleted_on timestamp NULL; + +ALTER TABLE users DROP CONSTRAINT IF EXISTS users_username_key; +CREATE UNIQUE INDEX users_username_idx ON users (username) WHERE NOT is_deleted; \ No newline at end of file