import { MigrationInterface , QueryRunner } from 'typeorm' ; export class AddUserEntity1568488639271 implements MigrationInterface { public async up ( queryRunner ) { await queryRunner . query ( `CREATE EXTENSION IF NOT EXISTS "uuid-ossp"` ) ; await queryRunner . query ( `CREATE TYPE "user_role_enum" AS ENUM('VIEWER', 'EDITOR', 'SPEAKER', 'ADMIN')` ) ; await queryRunner . query ( `CREATE TABLE "user" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "firstName" character varying, "lastName" character varying, "email" character varying NOT NULL, "phone" character varying, "role" "user_role_enum" NOT NULL DEFAULT 'SPEAKER', "createdAt" TIMESTAMP NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "PK_cace4a159ff9f2512dd42373760" PRIMARY KEY ("id"))` ) ; await queryRunner . query ( `CREATE UNIQUE INDEX "IDX_e12875dfb3b1d92d7d7c5377e2" ON "user" ("email") ` ) ; } public async down ( queryRunner ) { await queryRunner . query ( `DROP INDEX "IDX_e12875dfb3b1d92d7d7c5377e2"` ) ; await queryRunner . query ( `DROP TABLE "user"` ) ; await queryRunner . query ( `DROP TYPE "user_role_enum"` ) ; } }