mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-11-27 09:04:54 +00:00
feat: add validation for documents
This commit is contained in:
@ -0,0 +1,17 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
export class AddCreatedByToDocumentTable1736753223884 implements MigrationInterface {
|
||||
name = 'AddCreatedByToDocumentTable1736753223884';
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "documents" ADD "created_by_id" uuid `);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "documents" ADD CONSTRAINT "FK_7f46f4f77acde1dcedba64cb220" FOREIGN KEY ("created_by_id") REFERENCES "users"("id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
||||
);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "documents" DROP CONSTRAINT "FK_7f46f4f77acde1dcedba64cb220"`);
|
||||
await queryRunner.query(`ALTER TABLE "documents" DROP COLUMN "created_by_id"`);
|
||||
}
|
||||
}
|
||||
@ -18,3 +18,4 @@ export * from './1734601976591-create-allowance-entities';
|
||||
export * from './1734861516657-create-gift-entities';
|
||||
export * from './1734944692999-create-notification-entity-and-edit-device';
|
||||
export * from './1736414850257-add-flags-to-user-entity';
|
||||
export * from './1736753223884-add_created_by_to_document_table';
|
||||
|
||||
Reference in New Issue
Block a user