forked from twentyhq/twenty
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update foreign table to distant table schema (twentyhq#5508)
Closes twentyhq#5069 back-end part And: - do not display schemaPendingUpdates status on remote server lists as this call will become too costly if there are dozens of servers - (refacto) create foreignTableService After this is merged we will be able to delete remoteTable's availableTables column
- Loading branch information
Showing
21 changed files
with
618 additions
and
296 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
...ty-server/src/database/typeorm/metadata/migrations/1716310822694-removeAvailableTables.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm'; | ||
|
||
export class RemoveAvailableTables1716310822694 implements MigrationInterface { | ||
name = 'RemoveAvailableTables1716310822694'; | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
`ALTER TABLE "metadata"."remoteServer" DROP COLUMN "availableTables"`, | ||
); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
`ALTER TABLE "metadata"."remoteServer" ADD "availableTables" jsonb`, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...c/engine/metadata-modules/remote-server/remote-table/distant-table/types/distant-table.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { PostgresTableSchemaColumn } from 'src/engine/metadata-modules/remote-server/types/postgres-table-schema-column'; | ||
|
||
export type DistantTables = { | ||
[tableName: string]: PostgresTableSchemaColumn[]; | ||
[distantTableName: string]: PostgresTableSchemaColumn[]; | ||
}; |
11 changes: 10 additions & 1 deletion
11
.../engine/metadata-modules/remote-server/remote-table/dtos/find-many-remote-tables-input.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,18 @@ | ||
import { InputType, ID } from '@nestjs/graphql'; | ||
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 pending schema updates status should be computed.', | ||
nullable: true, | ||
}) | ||
shouldFetchPendingSchemaUpdates?: boolean; | ||
} |
19 changes: 19 additions & 0 deletions
19
.../engine/metadata-modules/remote-server/remote-table/foreign-table/foreign-table.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Module } from '@nestjs/common'; | ||
|
||
import { ForeignTableService } from 'src/engine/metadata-modules/remote-server/remote-table/foreign-table/foreign-table.service'; | ||
import { WorkspaceCacheVersionModule } from 'src/engine/metadata-modules/workspace-cache-version/workspace-cache-version.module'; | ||
import { WorkspaceMigrationModule } from 'src/engine/metadata-modules/workspace-migration/workspace-migration.module'; | ||
import { WorkspaceDataSourceModule } from 'src/engine/workspace-datasource/workspace-datasource.module'; | ||
import { WorkspaceMigrationRunnerModule } from 'src/engine/workspace-manager/workspace-migration-runner/workspace-migration-runner.module'; | ||
|
||
@Module({ | ||
imports: [ | ||
WorkspaceMigrationModule, | ||
WorkspaceMigrationRunnerModule, | ||
WorkspaceDataSourceModule, | ||
WorkspaceCacheVersionModule, | ||
], | ||
providers: [ForeignTableService], | ||
exports: [ForeignTableService], | ||
}) | ||
export class ForeignTableModule {} |
Oops, something went wrong.