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
Preview feature feedback: Prisma multi schema support (multiSchema
)
#15077
Comments
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Well, not sure why you need to list the schemas in |
Hi, I tried using the multischema feature as explained, Thanks! |
This will work later @shaked420 - it is a known limitation right now. You will need give the models different names, and then use |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Really appreciate you guys working so hard on this. Any idea when CockroachDB will be supported? |
I must be missing something obvious. Introspection, migrate, and push aren't supported. So all we can do is generate a client from manually written schema? |
For the record, I think Prisma will always struggle with non-relational databases. With things like EdgeDB and SurrealDB on the horizon with their own SDK's, Sanity.io GROQ like languages, built in GraphQL APIs, etc, there will likely be less of a need for ORMs in the next generation of databases. In regards to Prisma now on multi-schemas it seems the experimentation is limited. I definitely understand the effort needed here. Big changes to the underlying engine are likely needed. So all I can really do is some side experimentation, it's difficult to just start using this in a side project and put this to any real test. |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Awesome Feature, I would like to ask how long it will support Migrate, I think it`s a important feature |
We are working on that right now, you can follow other issues with the |
Car les deux écrivent dans des schémas séparés, et que la feature "multiSchema" de prisma est encore en preview et ne supporte pas les migration (on a eu des erreurs PG 42P07 lors des prisma migrate reset) - prisma/prisma#15077 (comment)
@shaked420 This problem should be fixed now. In general the So please test it, and ler us know how it goes! |
This is fantastic news! Thank you for the update and for all of the hard work! Excited to dive in and start checking it out! |
@janpio any news on when will this get exposed on |
What exactly would you expect there @albertilagan? |
Hmm, I was expecting it to have a
I'm using a generator named
|
Thanks for pointing that out, we will look into that @albertilagan. Might have missed this. |
Hey guys. I managed to merge two different MySQL schemas manually (added specifics @schemas("..."), previewFeature, etc) and apparently it generated correctly and I'm able to use it. So, for MySQL only |
We don't really know, because we are not testing for it until #16943 has been fully implemented. But good signal, that things already partially work 😆 |
I tried this for the first time today because I have a single foreign key in my primary schema that references another. I was pretty dismayed to find out that prisma generated a prisma-schema for the entire secondary schema. I don't want the client that's generated to have access to that at all. This use case involves a foreign key to a supabase auth schema, which supabase explicitly mentions many times throughout documentation that the recommendation is not to write to that schema as its managed. Please don't tell me I have to add some kind of magical ignore tag to every single table in that secondary schema. That would be a pretty poor DX. |
I am utilizing Prisma with SQL Server and have two schemas in my database. However, when I provide a schema array in the datasource, Prisma only generates a model for the first index of the schema array |
I do too, I'm trying to use prisma's new feature which is provided to support multi schema but as you said it returns only the 0 index of the schema array |
Can you define what "first index of the schema array" or "0 index of the schema array" means @erfaneslami @Hadi-bakhshi? Can you maybe illustrate it with an example? That would be helpful. @shellscape That is why we do preview features, or ask for input for features before we build them: We require the input of the community to know about the things they deem essential. Being able to only include individual tables from the second schema has not explicitly come up (often) in that context, although generally being able to only manage parts of a database is sometimes mentioned (and there are issues for it) - but not often enough that it would have made it to the top of our list of things to implement yet. |
FWIW I haven't worked on a team that hasn't had their database spread out across multiple schemas in the last 10 years. It's incredibly common and I hope that factors into your planning and decision making. (Perhaps Prisma is for more simple database needs and I'm trying to force it to be a more advanced tool than it is) |
@janpio yes sure here's an example of my code
when i use command 'npx prisma db pull' it only create model for Person schema , and if i remove the Person from array , only pulls dbo i have lots of schemas on my database and i want to pull them all |
@janpio is there a timeline on promoting |
No, currently there is not. If you are ok with the feedback that is being gathered here and under |
multiSchema feature is not working with |
This: there seems to be issues with migrator. Of course would be nice that multiSchemas were allowed to be imported from other schema.prismas that we wouldn't need to copy-paste such "shared" schemas. Not only allowing multi-schema but common single-source-of-truth schemas. But maybe that's not needed to make this generally available. |
Here are details on how the preview feature for multi schema support currently works in Prisma: #1122 (comment)
Please share your feedback about the
multiSchema
functionality released in v4.3.0 in this issue.If you have any questions, don't hesitate to ask them in the
#prisma-client
channel in the Prisma Slack.The text was updated successfully, but these errors were encountered: