fix(backend): システムアカウント系のマイグレーション不足を修正 (#15586)
* fix(backend): プロキシアカウントのロールバック用マイグレーションを追加 * fix * separate newly-added `up` command * drop backwards-compatibility * docs
This commit is contained in:
@@ -10,10 +10,10 @@ export class SystemAccounts31740133121105 {
|
||||
await queryRunner.query(`ALTER TABLE "meta" ADD "rootUserId" character varying(32)`);
|
||||
await queryRunner.query(`ALTER TABLE "meta" ADD CONSTRAINT "FK_c80e4079d632f95eac06a9d28cc" FOREIGN KEY ("rootUserId") REFERENCES "user"("id") ON DELETE SET NULL ON UPDATE NO ACTION`);
|
||||
|
||||
const users = await queryRunner.query(`SELECT "id" FROM "user" WHERE "isRoot" = true LIMIT 1`);
|
||||
if (users.length > 0) {
|
||||
await queryRunner.query(`UPDATE "meta" SET "rootUserId" = $1`, [users[0].id]);
|
||||
}
|
||||
const users = await queryRunner.query(`SELECT "id" FROM "user" WHERE "isRoot" = true LIMIT 1`);
|
||||
if (users.length > 0) {
|
||||
await queryRunner.query(`UPDATE "meta" SET "rootUserId" = $1`, [users[0].id]);
|
||||
}
|
||||
}
|
||||
|
||||
async down(queryRunner) {
|
||||
|
Reference in New Issue
Block a user