feat: initial commit

This commit is contained in:
2026-04-09 20:52:10 -03:00
commit 1a92cc6c11
86 changed files with 19533 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
export class AddsUserTable1775776680658 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()
);
CREATE TRIGGER set_users_updated_at
BEFORE UPDATE on users
FOR EACH ROW
EXECUTE FUNCTION set_updated_at();
--end-sql`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`--sql
DROP TABLE users CASCADE;
DROP TYPE user_role;
--end-sql`);
}
}