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
multiSchema does not work with SQL Server schemas with dot in name (= databases) #15696
Comments
Note from Microsoft's docs about
|
Note: The schema string that "works" actually includes database names: @chagriani Is it correct that you want to combine two schemas from different databases? Does SQL Server even allow foreign keys and queries across database boundaries? |
Yes I am combining 2 schemas for different database. SQL Server does not allow cross-database foreign keys, but allows queries between them. SELECT *
FROM database1.dbo.table1 as tb1
inner join database2.dbo.table2 as tb2 on tb1.id=tb2.id_tb1 |
Sorry, now I understand the schema concept and why multiSchema. In my use case I have several databases where they communicate with each other, but they have no relationship. In Prisma, willingly or not, it was possible to query between databases with this new multiSchema architecture with this declaration |
Yeah, that makes sense. You "hacked" our system 👍 😆 I fear we will probably have to limit that first, before we can properly enable this. Right now the foreign keys are a important requirement for a relation in Prisma. We will open that up sooner or later, and then that would also enable doing |
You don't know how happy the return of this consultation made me. But that's ok. I will wait for Thank you so much |
Hey @chagriani, could you please share the specific error that you're running into? |
Naturally this breaks in every engine. Here's what introspection engine gives us:
We do not support multi-database schemas with any database. But, you should try out Prisma 4.8.0 tomorrow that does let you to migrate and introspect multi-schema databases with SQL Server. |
What this issue shows is a hacky way to allow tracking models in separate databases using So while we won't officially support this, we will also not add code to specifically detect and error in this case.
So use at your own risk. |
Bug description
In sqlserver when declaring several schemas, it was not possible to perform a select. There was a table not found error in the database
How to reproduce
(#15077 (comment))
Expected behavior
No response
Prisma information
Its work
Does not work
Environment & setup
Prisma Version
The text was updated successfully, but these errors were encountered: