sharkey/packages/backend/migration/1700228972000-update-indexable.js
2024-06-15 11:36:55 +01:00

21 lines
817 B
JavaScript

/*
* SPDX-FileCopyrightText: marie and other Sharkey contributors
* SPDX-License-Identifier: AGPL-3.0-only
*/
export class UpdateIndexable1700228972000 {
name = 'UpdateIndexable1700228972000'
async up(queryRunner) {
await queryRunner.query(`ALTER TABLE "user" RENAME COLUMN "isIndexable" TO "noindex"`);
await queryRunner.query(`ALTER TABLE "user" ALTER COLUMN "noindex" SET DEFAULT false`);
await queryRunner.query(`UPDATE "user" SET "noindex" = NOT "noindex"`);
}
async down(queryRunner) {
await queryRunner.query(`UPDATE "user" SET "noindex" = NOT "noindex"`);
await queryRunner.query(`ALTER TABLE "user" ALTER COLUMN "noindex" SET DEFAULT true`);
await queryRunner.query(`ALTER TABLE "user" RENAME COLUMN "noindex" TO "isIndexable"`);
}
}