Files
zod-backend/src/db/migrations/1733206728721-create-user-entity.ts

30 lines
1.2 KiB
TypeScript

import { MigrationInterface, QueryRunner } from 'typeorm';
export class CreateUserEntity1733206728721 implements MigrationInterface {
name = 'CreateUserEntity1733206728721';
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`CREATE TABLE "users" (
"id" uuid NOT NULL DEFAULT uuid_generate_v4(),
"email" character varying(255),
"phone_number" character varying(255) NOT NULL,
"country_code" character varying(10) NOT NULL,
"password" character varying(255),
"salt" character varying(255),
"google_id" character varying(255),
"apple_id" character varying(255),
"is_profile_completed" boolean NOT NULL DEFAULT false,
"roles" text array,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
"updated_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
CONSTRAINT "PK_a3ffb1c0c8416b9fc6f907b7433" PRIMARY KEY ("id"))`,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "users" DROP CONSTRAINT "FK_02ec15de199e79a0c46869895f4"`);
await queryRunner.query(`DROP TABLE "users"`);
}
}