Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create remoteServer object within metadata schema #3742

Closed
Tracked by #3920
FelixMalfait opened this issue Jan 31, 2024 · 0 comments
Closed
Tracked by #3920

Create remoteServer object within metadata schema #3742

FelixMalfait opened this issue Jan 31, 2024 · 0 comments
Labels
scope: backend Issues that are affecting the backend side only

Comments

@FelixMalfait
Copy link
Member

FelixMalfait commented Jan 31, 2024

Context

The first step to create a remote object is to setup a server with user mappings.

CREATE SERVER test_foreign_db FOREIGN DATA WRAPPER postgres_fdw OPTIONS (host 'psql-mock-database-cloud.postgres.database.azure.com', dbname 'cars1682450166582wiwvrnbqarbjelto', port '5432');
CREATE USER MAPPING FOR twenty SERVER test_foreign_db OPTIONS(user 'agykwsuvotdyuuoqvkftpdgg@psql-mock-database-cloud', password 'atcnvtivakgkkwlnjukflihf')
IMPORT FOREIGN SCHEMA public FROM SERVER test_foreign_db INTO workspace_8z3y1vdaefh8qf1spgqfxswaq;

We need to create an API to do this.

We'll try to rely on Postgres' internal tables as much as we can to avoid duplicate data but we still need to create an intermediate table to keep a reference to the server and credentials.

Implementation

Create a new table remoteServer with the metadata schema.

Fields

  • id (string)
  • createdAt (string)
  • updatedAt (string)
  • serverName (unique)
  • options (string or json?)
  • workspaceId (foreign key)

Note: a server usually represent a connection to a database which can hold multiple schemas. To avoid having to deal with this complexity we will ask for the schema name directly upon server creation (store in options). If a database contains multiple schemas that the user wants to access in Twenty, then the user will have to add multiple remoteServers. This might evolve in future iterations but is good enough for now.

@FelixMalfait FelixMalfait changed the title Create remoteServer object within medata schema Create remoteServer object within metadata schema Jan 31, 2024
This was referenced Feb 13, 2024
@FelixMalfait FelixMalfait added the scope: backend Issues that are affecting the backend side only label Feb 13, 2024
@github-project-automation github-project-automation bot moved this from 🆕 New to ✅ Done in 🎯 Roadmap & Sprints Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: backend Issues that are affecting the backend side only
Projects
Archived in project
Development

No branches or pull requests

1 participant