Skip to content

Commit

Permalink
pretty
Browse files Browse the repository at this point in the history
  • Loading branch information
mozharov committed Feb 21, 2024
1 parent 1b82c21 commit 798de43
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions src/migrations/1708534487221-migration.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { MigrationInterface, QueryRunner } from "typeorm";
import {MigrationInterface, QueryRunner} from 'typeorm'

export class Migration1708534487221 implements MigrationInterface {
name = 'Migration1708534487221'
name = 'Migration1708534487221'

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
CREATE TABLE "profile" (
"id" uuid NOT NULL DEFAULT uuid_generate_v4(),
"title" character varying NOT NULL,
Expand All @@ -13,20 +13,19 @@ export class Migration1708534487221 implements MigrationInterface {
"ownerId" uuid NOT NULL,
CONSTRAINT "PK_3dd8bfc97e4a77c70971591bdcb" PRIMARY KEY ("id")
)
`);
await queryRunner.query(`
`)
await queryRunner.query(`
ALTER TABLE "profile"
ADD CONSTRAINT "FK_552aa6698bb78970f6569161ec0" FOREIGN KEY ("ownerId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION
`);
}
`)
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
ALTER TABLE "profile" DROP CONSTRAINT "FK_552aa6698bb78970f6569161ec0"
`);
await queryRunner.query(`
`)
await queryRunner.query(`
DROP TABLE "profile"
`);
}

`)
}
}

0 comments on commit 798de43

Please sign in to comment.