Compare distant tables schema with remote tables schema (#5413)

Closes #4532 and part of #5062
This commit is contained in:
Marie
2024-05-15 15:47:54 +02:00
committed by GitHub
parent 815b849968
commit 38eb293b3c
14 changed files with 265 additions and 52 deletions

View File

@ -0,0 +1,17 @@
import { InputType, ID, Field } from '@nestjs/graphql';
import { IDField } from '@ptc-org/nestjs-query-graphql';
import { IsOptional } from 'class-validator';
@InputType()
export class FindManyRemoteTablesInput {
@IDField(() => ID, { description: 'The id of the remote server.' })
id!: string;
@IsOptional()
@Field(() => Boolean, {
description: 'Indicates if data from distant tables should be refreshed.',
nullable: true,
})
refreshData?: boolean;
}

View File

@ -1,7 +1,7 @@
import { ObjectType, Field, registerEnumType } from '@nestjs/graphql';
import { IDField } from '@ptc-org/nestjs-query-graphql';
import { IsEnum, IsOptional } from 'class-validator';
import { IsOptional } from 'class-validator';
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
@ -10,11 +10,23 @@ export enum RemoteTableStatus {
NOT_SYNCED = 'NOT_SYNCED',
}
export enum TableUpdate {
TABLE_DELETED = 'TABLE_DELETED',
COLUMNS_DELETED = 'COLUMN_DELETED',
COLUMNS_ADDED = 'COLUMN_ADDED',
COLUMNS_TYPE_CHANGED = 'COLUMN_TYPE_CHANGED',
}
registerEnumType(RemoteTableStatus, {
name: 'RemoteTableStatus',
description: 'Status of the table',
});
registerEnumType(TableUpdate, {
name: 'TableUpdate',
description: 'Schema update on a table',
});
@ObjectType('RemoteTable')
export class RemoteTableDTO {
@IDField(() => UUIDScalarType, { nullable: true })
@ -23,11 +35,14 @@ export class RemoteTableDTO {
@Field(() => String)
name: string;
@IsEnum(RemoteTableStatus)
@Field(() => RemoteTableStatus)
status: RemoteTableStatus;
@IsOptional()
@Field(() => String, { nullable: true })
schema?: string;
@IsOptional()
@Field(() => [TableUpdate], { nullable: true })
schemaPendingUpdates?: [TableUpdate];
}