Convert metadata tables to camel_case (#2420)

* Convert metadata tables to camelcase

* refactor folder structure

* rename datasourcemetadata

* regenerate metadata schema

* rename dataSourceMetadata to dataSource
This commit is contained in:
Weiko
2023-11-10 15:33:25 +01:00
committed by GitHub
parent 6e7ad5eabc
commit 04c618284f
98 changed files with 1189 additions and 1735 deletions

View File

@ -32,8 +32,8 @@ export type TenantMigrationTableAction = {
action: 'create' | 'alter';
columns?: TenantMigrationColumnAction[];
};
@Entity('tenant_migrations')
export class TenantMigration {
@Entity('tenantMigration')
export class TenantMigrationEntity {
@PrimaryGeneratedColumn('uuid')
id: string;

View File

@ -2,10 +2,10 @@ import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { TenantMigrationService } from './tenant-migration.service';
import { TenantMigration } from './tenant-migration.entity';
import { TenantMigrationEntity } from './tenant-migration.entity';
@Module({
imports: [TypeOrmModule.forFeature([TenantMigration], 'metadata')],
imports: [TypeOrmModule.forFeature([TenantMigrationEntity], 'metadata')],
exports: [TenantMigrationService],
providers: [TenantMigrationService],
})

View File

@ -1,27 +0,0 @@
import { Test, TestingModule } from '@nestjs/testing';
import { getRepositoryToken } from '@nestjs/typeorm';
import { TenantMigrationService } from './tenant-migration.service';
import { TenantMigration } from './tenant-migration.entity';
describe('TenantMigrationService', () => {
let service: TenantMigrationService;
beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
providers: [
TenantMigrationService,
{
provide: getRepositoryToken(TenantMigration, 'metadata'),
useValue: {},
},
],
}).compile();
service = module.get<TenantMigrationService>(TenantMigrationService);
});
it('should be defined', () => {
expect(service).toBeDefined();
});
});

View File

@ -3,17 +3,17 @@ import { InjectRepository } from '@nestjs/typeorm';
import { IsNull, Repository } from 'typeorm';
import { standardMigrations } from './standard-migrations';
import {
TenantMigration,
TenantMigrationEntity,
TenantMigrationTableAction,
} from './tenant-migration.entity';
import { standardMigrations } from './standard-migrations';
@Injectable()
export class TenantMigrationService {
constructor(
@InjectRepository(TenantMigration, 'metadata')
private readonly tenantMigrationRepository: Repository<TenantMigration>,
@InjectRepository(TenantMigrationEntity, 'metadata')
private readonly tenantMigrationRepository: Repository<TenantMigrationEntity>,
) {}
/**
@ -60,7 +60,7 @@ export class TenantMigrationService {
*/
public async getPendingMigrations(
workspaceId: string,
): Promise<TenantMigration[]> {
): Promise<TenantMigrationEntity[]> {
return await this.tenantMigrationRepository.find({
order: { createdAt: 'ASC' },
where: {
@ -79,7 +79,7 @@ export class TenantMigrationService {
*/
public async setAppliedAtForMigration(
workspaceId: string,
migration: TenantMigration,
migration: TenantMigrationEntity,
) {
await this.tenantMigrationRepository.save({
id: migration.id,