Also, how do I start again - like, just give me a ...
# orm-help
j
Also, how do I start again - like, just give me a schema from whatever is in the database. Then I would expect no migrations to be necessary.
1
r
Hi @James Pickard, for this question, are you referring to
introspection
? That is using the Prisma CLI to introspect your database in order to generate the data model.
j
So what I have typically been doing, is modifying the database schema using the usual tools, then pulling in to prisma.schema:
Copy code
rm -rf prisma
npx prisma init --datasource-provider MySQL
npx prisma db pull
This was easier for me than learning prisma.schema DSL
r
What you've been doing is called introspection in Prisma terms.
We can continue conversation here
j
yeah
So after introspecting my db with
prisma db pull
creating an initial migration with
npx prisma migrate dev --name init
wants to delete all my data
r
Are you working in dev or prod?
For development, prisma migrate will ask you to reset your database. For production, you can carry out baselining
This guide on adding prisma to an existing project will help.
j
Well, it’s a development environment but I do not wish to delete my data
It’s probably easier to treat it as a prod environment
r
Okay, Give it a try and let me know if you have any other queries
j
How do I generate a base migration from the current schema without resetting the data?
r
npx prisma migrate resolve --applied 20210426141759_initial-migration
you would need to use your own migration file