Integrate relations for remote objects (#4754)
Foreign table id cannot be a foreign key of a base table. But the current code use foreign keys to link object metadata with activities, events... So we will: - create a column without creating a foreign key - add a comment on the table schema so pg_graphql sees it as a foreign key This PR: - refactor a bit object metadata service so the mutation creation is separated into an util - adds the mutation creation for remote object relations - add a new type of mutation to create a comment --------- Co-authored-by: Thomas Trompette <thomast@twenty.com>
This commit is contained in:
@ -25,7 +25,8 @@ export class ForeignDataWrapperQueryFactory {
|
||||
foreignDataWrapperId: string,
|
||||
userMappingOptions: UserMappingOptions,
|
||||
) {
|
||||
return `CREATE USER MAPPING IF NOT EXISTS FOR ${userMappingOptions.username} SERVER "${foreignDataWrapperId}" OPTIONS (user '${userMappingOptions.username}', password '${userMappingOptions.password}')`;
|
||||
// CURRENT_USER works for now since we are using only one user. But if we switch to a user per workspace, we need to change this.
|
||||
return `CREATE USER MAPPING IF NOT EXISTS FOR CURRENT_USER SERVER "${foreignDataWrapperId}" OPTIONS (user '${userMappingOptions.username}', password '${userMappingOptions.password}')`;
|
||||
}
|
||||
|
||||
private buildNameAndOptionsFromType(
|
||||
|
||||
Reference in New Issue
Block a user