name beim kopieren

This commit is contained in:
Bastian Wagner
2026-06-09 16:03:20 +02:00
parent 06c5b1768e
commit 16605c961f
18 changed files with 693 additions and 44 deletions

View File

@@ -1,6 +1,7 @@
import 'dotenv/config';
import 'reflect-metadata';
import { DataSource } from 'typeorm';
import { AuditLogEntity } from '../audit/audit-log.entity';
import { UserEntity } from '../auth/user.entity';
import { RefreshTokenEntity } from '../auth/refresh-token.entity';
import { ListTemplateEntity } from '../list-templates/list-template.entity';
@@ -27,6 +28,7 @@ export default new DataSource({
logger: new DatabaseLogger(databaseLoggerOptionsFromEnv(process.env)),
maxQueryExecutionTime: slowQueryThresholdFromEnv(process.env),
entities: [
AuditLogEntity,
UserEntity,
RefreshTokenEntity,
ListTemplateEntity,

View File

@@ -0,0 +1,37 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
export class CreateAuditLogs1781200000000 implements MigrationInterface {
name = 'CreateAuditLogs1781200000000';
public async up(queryRunner: QueryRunner): Promise<void> {
if (await queryRunner.hasTable('audit_logs')) {
return;
}
await queryRunner.query(`
CREATE TABLE \`audit_logs\` (
\`id\` varchar(36) NOT NULL,
\`actorUserId\` varchar(36) NULL,
\`actorEmail\` varchar(320) NULL,
\`action\` varchar(100) NOT NULL,
\`entityType\` varchar(80) NULL,
\`entityId\` varchar(36) NULL,
\`metadata\` json NULL,
\`ipAddress\` varchar(64) NULL,
\`userAgent\` varchar(512) NULL,
\`createdAt\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
INDEX \`IDX_audit_logs_actor_user_id\` (\`actorUserId\`),
INDEX \`IDX_audit_logs_action\` (\`action\`),
INDEX \`IDX_audit_logs_entity\` (\`entityType\`),
INDEX \`IDX_audit_logs_created_at\` (\`createdAt\`),
PRIMARY KEY (\`id\`)
) ENGINE=InnoDB
`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
if (await queryRunner.hasTable('audit_logs')) {
await queryRunner.query('DROP TABLE `audit_logs`');
}
}
}