https://project.mdnd-it.cc/work_packages/94
This commit is contained in:
2025-08-23 04:25:28 +02:00
parent 725516ad6c
commit 19cfa031d0
25823 changed files with 1095587 additions and 2801760 deletions
@@ -0,0 +1,28 @@
import { execSync } from 'child_process';
const migrationName = process.argv[2];
if (!migrationName) {
console.error('Please provide a migration name: npm run migration:full <migration_name>');
process.exit(1);
}
try {
console.log(`Creating migration: ${migrationName}`);
execSync(`npx ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli migration:create ./src/Infrastructure/Migrationsettings/${migrationName}`, { stdio: 'inherit' });
console.log(`Generating migration: ${migrationName}`);
execSync(`npx ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli -d ./src/Infrastructure/ormconfig.ts migration:generate ./src/Infrastructure/Migrations/${migrationName}`, { stdio: 'inherit' });
console.log('Migration generated successfully!');
console.log('Running migration...');
execSync(`npx ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli -d ./src/Infrastructure/ormconfig.ts migration:run`, { stdio: 'inherit' });
} catch (error) {
if (error instanceof Error) {
console.error('Migration failed:', error.message);
} else {
console.error('Migration failed:', error);
}
process.exit(1);
}