prisma-engines
f2cca53a - feat(external tables): ORM-1254 require fully qualified names if multiple schemas used (#5558)

Commit
278 days ago
feat(external tables): ORM-1254 require fully qualified names if multiple schemas used (#5558) To avoid ambiguity in the table name matching users will have to specify fully qualified table names including the schema name when using multiple schemas. Otherwise they have to provide just the table name. Corresponding validation errors are raised. schemas in datasource | externalTables | Result -- | -- | -- ["schema_a", "schema_b"] | ["table_a"] | ❌ ["schema_a", "schema_b"] | ["schema_a.table_b"] | ✅ Not provided | ["table_a"] | ✅ Not provided | ["schema_a.table_b"] | ❌ New Errors: - `P3023`: When using an explicit schemas list in your datasource, externalTables in your prisma config must contain only fully qualified table names (e.g. schema_name.table_name). - `P3024`: When using no explicit schemas list in your datasource, externalTables in your prisma config must contain only simple table names without a schema name. > [!NOTE] > Previously we wanted that users have to always provide the fully qualified table name incl the schema. > > This turned out to be challenging because if no schema list is given in the datasource we do not parse schemas from the database. We could try to adjust this but this would require us to make assumptions about about a default schema name - esp. when loading the schema from a PSL file. > > Assuming a default schema name in such cases might lead to complications when comparing e.g. a schema derived from a PSL file with a schema derived from an existing DB or a list of migrations where the schema name might not match the default because another schema name was dynamically provided via the connection string.
Author
Parents
Loading