fix(server): tag upsert (#12141)

This commit is contained in:
Jason Rasmussen 2024-08-30 12:44:24 -04:00 committed by GitHub
parent b9e5e40ced
commit 9b1a985d29
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 163 additions and 41 deletions

View file

@ -0,0 +1,16 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class FixTagUniqueness1725023079109 implements MigrationInterface {
name = 'FixTagUniqueness1725023079109'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "tags" DROP CONSTRAINT "UQ_d090e09fe86ebe2ec0aec27b451"`);
await queryRunner.query(`ALTER TABLE "tags" ADD CONSTRAINT "UQ_79d6f16e52bb2c7130375246793" UNIQUE ("userId", "value")`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "tags" DROP CONSTRAINT "UQ_79d6f16e52bb2c7130375246793"`);
await queryRunner.query(`ALTER TABLE "tags" ADD CONSTRAINT "UQ_d090e09fe86ebe2ec0aec27b451" UNIQUE ("value")`);
}
}