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

Expand our Prisma support (enum, type, other dbs, ...) #641

Open
Martinsos opened this issue Jun 23, 2022 · 12 comments
Open

Expand our Prisma support (enum, type, other dbs, ...) #641

Martinsos opened this issue Jun 23, 2022 · 12 comments
Labels
database enhancement New feature or request epic Umbrella feature that encompasses multiple smaller features prisma

Comments

@Martinsos
Copy link
Member

Martinsos commented Jun 23, 2022

Wasp is heavily using Prisma for the DB layer of web app, but it doesn't yet utilize everything that Prisma offers. Here we can track some of the bigger items that we recognize would be cool to support in the future when we are ready / feel the need for them:

  1. Support for enum and type declarations in PSL. enum we should certainly add, while type is for now used for MongoDB, so probably no rush until we decide to also support MongoDB, or until type gets wider usage. Btw type is interesting since it pushes PSL closer to being the full data schema, closer to what GQL can do, and closer to what Wasp will need in the future in any case.
  2. Support for other databases next to Postgresql (they even support nosql databases like mongo and cockroach).
  3. [DONE] Seeding of the db: Support seeding the database #569
  4. Better utilize their migrations support: Support data migrations & provide best practices and examples #330
@Martinsos Martinsos added enhancement New feature or request epic Umbrella feature that encompasses multiple smaller features database labels Jun 23, 2022
@Martinsos
Copy link
Member Author

@Martinsos
Copy link
Member Author

Makes sense to solve this together with #887 .

@ldeavila
Copy link

ldeavila commented Mar 2, 2024

To address this, I used the existing seeder functionality as a workaround to execute a function that created the enum. This make me think if it would perhaps be more efficient to add direct support for executing DDL scripts within the framework?

Instead of continually expanding support for every specific Prisma modeling feature, a combination of DML (seeder functions) and DDL capabilities could provide a very robust and flexible solution. I believe this approach would cover the vast majority of use cases.

@Martinsos
Copy link
Member Author

That is an interesting idea! But it is a bit hacky, and the solution we have in mind to fix all this goes the other way -> it lets you write Prisma directly in Prisma files, which should solve all of these issues. So let's see how that goes, and if that works we rae great, if not I think we can examine your suggestion again!

@sodic
Copy link
Contributor

sodic commented Mar 22, 2024

User asking for Enums: https://discord.com/channels/686873244791210014/1220352081970466908/1220607862078836766.

The same user is also not a fan of having Prisma stuff inside Wasp and would prefer a separate schema.prisma file (the message below the linked one).

Full quote:

For the moment it's fine, except for the enum : I really need it in Prisma and it was almost a no-go to not have it...
Ideally it would be nice to have the schema.prisma at the root with all the Prisma features, and to not handle it in main.wasp (already a really big file here)

@Martinsos
Copy link
Member Author

Nice, ok that is the plan!

@sodic
Copy link
Contributor

sodic commented Mar 25, 2024

@Martinsos
Copy link
Member Author

Martinsos commented May 21, 2024

This will mostly be solved by the solution we are implementing for #887 , which is moving entities from main.wasp to prisma.schema file. The initial step of this effort is #2002 .

@infomiho
Copy link
Contributor

enums are now supported since #2035

This doesn't add support for views or types or other DB types.

@Martinsos
Copy link
Member Author

@infomiho how is it that we can't use views or types? Can't we just write those in prisma.schema and voila we use them?

@infomiho
Copy link
Contributor

Our parser doesn't yet support views or types, when we add support it will work 👍

@infomiho
Copy link
Contributor

We have support for views and type since #2179

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
database enhancement New feature or request epic Umbrella feature that encompasses multiple smaller features prisma
Projects
None yet
Development

No branches or pull requests

4 participants