Fix custom object requests pending (#2240)

* Fix custom object requests pending

* fix typo
This commit is contained in:
Weiko
2023-10-26 12:20:03 +02:00
committed by GitHub
parent c335d19c97
commit 781a1de8f4
2 changed files with 13 additions and 5 deletions

View File

@ -45,19 +45,20 @@ export class MigrationRunnerService {
// Loop over each migration and create or update the table
// TODO: Should be done in a transaction
for (const migration of flattenedPendingMigrations) {
await this.handleTableChanges(queryRunner, schemaName, migration);
}
// Update appliedAt date for each migration
// TODO: Should be done after the migration is successful
pendingMigrations.forEach(async (pendingMigration) => {
for (const pendingMigration of pendingMigrations) {
await this.tenantMigrationService.setAppliedAtForMigration(
workspaceId,
pendingMigration,
);
});
}
await queryRunner.release();
return flattenedPendingMigrations;
}
@ -188,6 +189,13 @@ export class MigrationRunnerService {
tableName: string,
migrationColumn: TenantMigrationColumnAction,
) {
const hasColumn = await queryRunner.hasColumn(
`${schemaName}.${tableName}`,
migrationColumn.name,
);
if (hasColumn) {
return;
}
await queryRunner.addColumn(
`${schemaName}.${tableName}`,
new TableColumn({

View File

@ -107,7 +107,7 @@ export class TenantInitialisationService {
dataSourceMetadata.id,
);
const worksapceDataSource =
const workspaceDataSource =
await this.dataSourceService.connectToWorkspaceDataSource(workspaceId);
for (const object of objects) {
@ -123,7 +123,7 @@ export class TenantInitialisationService {
Object.values(field.targetColumnMap),
);
worksapceDataSource
await workspaceDataSource
?.createQueryBuilder()
.insert()
.into(`${dataSourceMetadata.schema}.${object.targetTableName}`, columns)