Remove typeorm service (#14116)

## Context
To simplify the way we inject our default datasource, I've recently
removed the token injection that was confusion since we only had once
configured on the module level. Now I'm removing TypeORM service which
allows us to instantiate a new Datasource with the same parameters as
the default one, it was redundant and confusing.
This commit is contained in:
Weiko
2025-08-28 13:21:26 +02:00
committed by GitHub
parent f1706670f5
commit dec2239ae7
35 changed files with 240 additions and 399 deletions
@@ -1,6 +1,8 @@
import { Injectable } from '@nestjs/common';
import { InjectDataSource } from '@nestjs/typeorm';
import { DataSource } from 'typeorm';
import { TypeORMService } from 'src/database/typeorm/typeorm.service';
import { FeatureFlagService } from 'src/engine/core-modules/feature-flag/services/feature-flag.service';
import { TwentyConfigService } from 'src/engine/core-modules/twenty-config/twenty-config.service';
import { DataSourceService } from 'src/engine/metadata-modules/data-source/data-source.service';
@@ -15,7 +17,6 @@ import { WorkspaceSyncMetadataService } from 'src/engine/workspace-manager/works
@Injectable()
export class DevSeederService {
constructor(
private readonly typeORMService: TypeORMService,
private readonly workspaceCacheStorageService: WorkspaceCacheStorageService,
private readonly twentyConfigService: TwentyConfigService,
private readonly workspaceDataSourceService: WorkspaceDataSourceService,
@@ -25,20 +26,16 @@ export class DevSeederService {
private readonly devSeederMetadataService: DevSeederMetadataService,
private readonly devSeederPermissionsService: DevSeederPermissionsService,
private readonly devSeederDataService: DevSeederDataService,
@InjectDataSource()
private readonly coreDataSource: DataSource,
) {}
public async seedDev(workspaceId: string): Promise<void> {
const mainDataSource = this.typeORMService.getMainDataSource();
if (!mainDataSource) {
throw new Error('Could not connect to workspace data source');
}
const isBillingEnabled = this.twentyConfigService.get('IS_BILLING_ENABLED');
const appVersion = this.twentyConfigService.get('APP_VERSION');
await seedCoreSchema({
dataSource: mainDataSource,
dataSource: this.coreDataSource,
workspaceId,
seedBilling: isBillingEnabled,
appVersion,