mirror of
https://github.com/pieartsy/PluralFlux.git
synced 2026-04-16 22:35:28 +10:00
* add migration to delete duplicates that currently exist in the db * change model and migration to add a unique index constraint to id and name * renamed unique index name to be readable * redid model and migration to use @Unique instead of @Index * remove //Here comment --------- Co-authored-by: Aster Fialla <asterfialla@gmail.com>
15 lines
522 B
TypeScript
15 lines
522 B
TypeScript
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
|
|
export class Update1772830252670 implements MigrationInterface {
|
|
name = 'Update1772830252670'
|
|
|
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
await queryRunner.query(`ALTER TABLE "Member" ADD CONSTRAINT "UQ_Member_userid_name" UNIQUE ("userid", "name")`);
|
|
}
|
|
|
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
await queryRunner.query(`ALTER TABLE "Member" DROP CONSTRAINT "UQ_Member_userid_name"`);
|
|
}
|
|
|
|
}
|