Initial Commit

This commit is contained in:
2026-03-31 21:09:10 -03:00
commit 16cda78d10
84 changed files with 19428 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
export class AddsUserTable1774988438124 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`--sql
CREATE TYPE user_role AS ENUM ('admin', 'internal', 'user');
CREATE TABLE users (
id BIGSERIAL PRIMARY KEY,
name TEXT NOT NULL,
email TEXT NOT NULL UNIQUE,
role user_role NOT NULL DEFAULT 'user',
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
external_id UUID NOT NULL DEFAULT gen_random_uuid()
);
--end-sql`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`--sql
DROP TABLE users;
DROP TYPE user_role;
--end-sql`);
}
}