Generate a schema.prisma file from a *.sql file #4777
-
|
Hello. I'm trying out prisma for the first time by migrating an existing mysql DB to prisma. I'm stuck att generating a schema.prisma file from my *.sql dump. Can anyone point me in the right direction? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
|
Hey @redsuperbat 👋 Then, to add your tables to a As you're using MySQL, you would need to follow this tutorial to setup Prisma with an existing database. Let me know if it works :) |
Beta Was this translation helpful? Give feedback.
-
|
@ryands17 In the dev workflow of my team, we wrote DB migrations with So, in order to work with Prisma, the best way is to generate |
Beta Was this translation helpful? Give feedback.
-
|
@ryands17 Can you please guide what are the internal functions in Prisma codebase which convert database to schema file? |
Beta Was this translation helpful? Give feedback.
-
|
Hi there, To keep our discussions organized and focused on the most relevant topics, we’re reviewing and tidying up our backlog. As part of this process, we’re closing discussions that have already been marked as answered but remain open. If this discussion still requires further input or clarification, feel free to reopen it or start a new one with updated details. Your contributions are invaluable to the community, and we’re here to help! For more details about our priorities and vision for the future of Prisma ORM, check out our latest blog post: https://www.prisma.io/blog/prisma-orm-manifesto. Thank you for your understanding and ongoing support of the Prisma community! |
Beta Was this translation helpful? Give feedback.
Hey @redsuperbat 👋
You cannot directly create
schema.prismafrom a dump. You would need to connect to an existing database that has your data or import the dump that you have back in the DB.Then, to add your tables to a
schema.prismafile from your database is easy by using IntrospectionAs you're using MySQL, you would need to follow this tutorial to setup Prisma with an existing database.
Let me know if it works :)