Skip to content

Commit

Permalink
Delete cache version on reset db (#6426)
Browse files Browse the repository at this point in the history
As title
  • Loading branch information
thomtrp authored Jul 27, 2024
1 parent 5a1835e commit 368f142
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { InjectCacheStorage } from 'src/engine/integrations/cache-storage/decora
import { CacheStorageNamespace } from 'src/engine/integrations/cache-storage/types/cache-storage-namespace.enum';
import { DataSourceService } from 'src/engine/metadata-modules/data-source/data-source.service';
import { ObjectMetadataService } from 'src/engine/metadata-modules/object-metadata/object-metadata.service';
import { WorkspaceCacheVersionService } from 'src/engine/metadata-modules/workspace-cache-version/workspace-cache-version.service';
import { WorkspaceDataSourceService } from 'src/engine/workspace-datasource/workspace-datasource.service';
import { viewPrefillData } from 'src/engine/workspace-manager/standard-objects-prefill-data/view';
import { WorkspaceSyncMetadataService } from 'src/engine/workspace-manager/workspace-sync-metadata/workspace-sync-metadata.service';
Expand All @@ -48,6 +49,7 @@ export class DataSeedWorkspaceCommand extends CommandRunner {
private readonly objectMetadataService: ObjectMetadataService,
@InjectCacheStorage(CacheStorageNamespace.WorkspaceSchema)
private readonly workspaceSchemaCache: CacheStorageService,
private readonly workspaceCacheVersionService: WorkspaceCacheVersionService,
) {
super();
}
Expand All @@ -56,6 +58,7 @@ export class DataSeedWorkspaceCommand extends CommandRunner {
try {
for (const workspaceId of this.workspaceIds) {
await this.workspaceSchemaCache.flush();
await this.workspaceCacheVersionService.deleteVersion(workspaceId);

await rawDataSource.initialize();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,8 @@ export class WorkspaceCacheVersionService {

return workspaceCacheVersion?.version ?? null;
}

async deleteVersion(workspaceId: string): Promise<void> {
await this.workspaceCacheVersionRepository.delete({ workspaceId });
}
}

0 comments on commit 368f142

Please sign in to comment.