From f41ee9cf32a2deed6e2b6a6aa0ba3ea71b7e629c Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Wed, 10 Nov 2021 17:50:33 +0100 Subject: [PATCH] Remove deprecated migrations --- src/auth/migrations/DropNameFromUsers.ts | 14 ---------- .../migrations/FixUserMainEmailRelation.ts | 27 ------------------- 2 files changed, 41 deletions(-) delete mode 100644 src/auth/migrations/DropNameFromUsers.ts delete mode 100644 src/auth/migrations/FixUserMainEmailRelation.ts diff --git a/src/auth/migrations/DropNameFromUsers.ts b/src/auth/migrations/DropNameFromUsers.ts deleted file mode 100644 index 2c17da7..0000000 --- a/src/auth/migrations/DropNameFromUsers.ts +++ /dev/null @@ -1,14 +0,0 @@ -import Migration from "../../db/Migration.js"; - -/** - * @deprecated - TODO may be remove at next major version >= 0.24, replace with DummyMigration. - */ -export default class DropNameFromUsers extends Migration { - public async install(): Promise { - await this.query('ALTER TABLE users DROP COLUMN IF EXISTS name'); - } - - public async rollback(): Promise { - await this.query('ALTER TABLE users ADD COLUMN name VARCHAR(64)'); - } -} diff --git a/src/auth/migrations/FixUserMainEmailRelation.ts b/src/auth/migrations/FixUserMainEmailRelation.ts deleted file mode 100644 index 6ec6a41..0000000 --- a/src/auth/migrations/FixUserMainEmailRelation.ts +++ /dev/null @@ -1,27 +0,0 @@ -import Migration from "../../db/Migration.js"; - -/** - * @deprecated - TODO may be remove at next major version >= 0.24, replace with DummyMigration. - */ -export default class FixUserMainEmailRelation extends Migration { - public async install(): Promise { - await this.query(`ALTER TABLE users - ADD COLUMN main_email_id INT, - ADD FOREIGN KEY main_user_email_fk (main_email_id) REFERENCES user_emails (id)`); - await this.query(`UPDATE users u LEFT JOIN user_emails ue ON u.id = ue.user_id - SET u.main_email_id=ue.id - WHERE ue.main = true`); - await this.query(`ALTER TABLE user_emails - DROP COLUMN main`); - } - - public async rollback(): Promise { - await this.query(`ALTER TABLE user_emails - ADD COLUMN main BOOLEAN DEFAULT false`); - await this.query(`UPDATE user_emails ue LEFT JOIN users u ON ue.id = u.main_email_id - SET ue.main = true`); - await this.query(`ALTER TABLE users - DROP FOREIGN KEY main_user_email_fk, - DROP COLUMN main_email_id`); - } -}