NestJS-Boilerplate/migrations/1691602467422-migrations.ts
2024-06-10 10:21:25 -03:00

15 lines
757 B
TypeScript

import { MigrationInterface, QueryRunner } from "typeorm";
export class Migrations1691602467422 implements MigrationInterface {
name = 'Migrations1691602467422'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE TABLE "companies" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "name" character varying NOT NULL, "deleted_at" TIMESTAMP, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "updated_at" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "UQ_3dacbb3eb4f095e29372ff8e131" UNIQUE ("name"), CONSTRAINT "PK_d4bc3e82a314fa9e29f652c2c22" PRIMARY KEY ("id"))`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DROP TABLE "companies"`);
}
}