refactor(rooms): remove dorm gender restrictions
This commit is contained in:
@@ -15,6 +15,7 @@ export class DatabaseMigrationsService implements OnApplicationBootstrap {
|
||||
await this.normalizeClassDates();
|
||||
await this.protectAttendanceHistory();
|
||||
await this.removeUnusedClassroomColumns();
|
||||
await this.removeUnusedRoomColumns();
|
||||
await this.cleanupDepositRefundColumns();
|
||||
await this.removeUnusedClassStudentColumns();
|
||||
await this.normalizeClassroomStatuses();
|
||||
@@ -39,6 +40,22 @@ export class DatabaseMigrationsService implements OnApplicationBootstrap {
|
||||
}
|
||||
}
|
||||
|
||||
private async removeUnusedRoomColumns(): Promise<void> {
|
||||
const runner = this.dataSource.createQueryRunner();
|
||||
await runner.connect();
|
||||
try {
|
||||
const tables = await runner.getTables(['rooms']);
|
||||
if (tables.length === 0) return;
|
||||
|
||||
const table = await runner.getTable('rooms');
|
||||
if (table?.columns.some((column) => column.name === 'gender')) {
|
||||
await runner.dropColumn('rooms', 'gender');
|
||||
}
|
||||
} finally {
|
||||
await runner.release();
|
||||
}
|
||||
}
|
||||
|
||||
private async cleanupDepositRefundColumns(): Promise<void> {
|
||||
const runner = this.dataSource.createQueryRunner();
|
||||
await runner.connect();
|
||||
|
||||
Reference in New Issue
Block a user