Skip to content

Commit

Permalink
não estou conseguindo salvar anotações [clziuwya40000w90le2yly71t]
Browse files Browse the repository at this point in the history
  • Loading branch information
pauloendoh committed Aug 6, 2024
1 parent 39b806e commit 81dc482
Showing 1 changed file with 10 additions and 23 deletions.
33 changes: 10 additions & 23 deletions src/migrations/1722899892198-Migration.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,15 @@
import { MigrationInterface, QueryRunner } from "typeorm";
import { MigrationInterface, QueryRunner } from "typeorm"

export class Migration1722899892198 implements MigrationInterface {
name = 'Migration1722899892198'
name = "Migration1722899892198"

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "question" DROP CONSTRAINT "FK_960e423bd8c1f0d9913bc1c099e"`);
await queryRunner.query(`ALTER TABLE "question" DROP CONSTRAINT "FK_5b87d9d19127bd5d92026017a7b"`);
await queryRunner.query(`ALTER TABLE "skill" ADD "discomfortZone" double precision`);
await queryRunner.query(`CREATE SEQUENCE IF NOT EXISTS "question_id_seq" OWNED BY "question"."id"`);
await queryRunner.query(`ALTER TABLE "question" ALTER COLUMN "id" SET DEFAULT nextval('"question_id_seq"')`);
await queryRunner.query(`ALTER TABLE "question" ALTER COLUMN "id" DROP DEFAULT`);
await queryRunner.query(`ALTER TABLE "question" ADD CONSTRAINT "FK_80f29cc01d0bd1644e389cc13be" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE "question" ADD CONSTRAINT "FK_70f9da8788aa253b76bb919c872" FOREIGN KEY ("docId") REFERENCES "doc"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "question" DROP CONSTRAINT "FK_70f9da8788aa253b76bb919c872"`);
await queryRunner.query(`ALTER TABLE "question" DROP CONSTRAINT "FK_80f29cc01d0bd1644e389cc13be"`);
await queryRunner.query(`ALTER TABLE "question" ALTER COLUMN "id" SET DEFAULT nextval('note_id_seq')`);
await queryRunner.query(`ALTER TABLE "question" ALTER COLUMN "id" DROP DEFAULT`);
await queryRunner.query(`DROP SEQUENCE "question_id_seq"`);
await queryRunner.query(`ALTER TABLE "skill" DROP COLUMN "discomfortZone"`);
await queryRunner.query(`ALTER TABLE "question" ADD CONSTRAINT "FK_5b87d9d19127bd5d92026017a7b" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE "question" ADD CONSTRAINT "FK_960e423bd8c1f0d9913bc1c099e" FOREIGN KEY ("docId") REFERENCES "doc"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
}
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "skill" ADD "discomfortZone" double precision`
)
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "skill" DROP COLUMN "discomfortZone"`)
}
}

0 comments on commit 81dc482

Please sign in to comment.