Prisma does not support SQL Server Schemas
See original GitHub issueBug description
Hi,
Prisma does not support SQL Server Schemas, all queries are prefixed with dbo.
[dbo] is the default schema in SQL Server, it does not need to be prefixed against each query. My suggestion is that you drop the dbo prefix when a @@map is used for a table. i.e when you are referencing a table schema.
i.e.
model MyTable {
MyTableID Int @id @default(autoincrement())
Description String @unique
@@map(name: "MySchema.MyTable")
}
does not work because a query of
SELECT MyTableID,Description FROM dbo.MySchema.MyTable
is invalid.
Correct Query would be
SELECT MyTableID,Description FROM MySchema.MyTable
Please could we get a fix this issue or point me to the SQL Generator Module and I could have a look myself. It should be a simple fix.
Many Thanks
Toby.
How to reproduce
Issue a query to a SQL server backend that has a table in a non-dbo schema.
Expected behavior
To be able to issue a query to a SQL server backend that has a table in a non-dbo schema.
Prisma information
Environment & setup
- OS: Windows
- Database: Sql Server
- Node.js version: 16
Prisma Version
prisma : 3.4.0
@prisma/client : 3.4.0
Current platform : windows
Query Engine (Node-API) : libquery-engine 1c9fdaa9e2319b814822d6dbfd0a69e1fcc13a85 (at node_modules\@prisma\engines\query_engine-windows.dll.node)
Migration Engine : migration-engine-cli 1c9fdaa9e2319b814822d6dbfd0a69e1fcc13a85 (at node_modules\@prisma\engines\migration-engine-windows.exe)
Introspection Engine : introspection-core 1c9fdaa9e2319b814822d6dbfd0a69e1fcc13a85 (at node_modules\@prisma\engines\introspection-engine-windows.exe)
Format Binary : prisma-fmt 1c9fdaa9e2319b814822d6dbfd0a69e1fcc13a85 (at node_modules\@prisma\engines\prisma-fmt-windows.exe)
Default Engines Hash : 1c9fdaa9e2319b814822d6dbfd0a69e1fcc13a85
Studio : 0.438.0
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Thanks for that, I’ll give it a try. Roll on trying to solve the multiple schema scenario, it’s really important.
Yes, which is why https://github.com/prisma/prisma/issues/1122 exists as I mentioned above and we will sooner or later implement this.