I am continuing to have a pretty bad time with mig...
# orm-help
j
I am continuing to have a pretty bad time with migrations. I basically never want prisma to delete all my data, even in dev.
1
r
Hi @James Pickard 👋 You can go through this guide on developing with prisma migrate to help you understand how to work with migrations.
j
So the workflow I have been using is to modify the schema directly on the database, then:
Copy code
rm -rf prisma
npx prisma init --datasource-provider MySQL
npx prisma db pull
I find this is easier than learning the prisma.schema DSL
but I have noticed that for some reason, one of the foreign keys generates a model property with a plural, which is weird
e.g. there’s a column
control_group_id
on my
slides
table, but the field that Prisma generates is
control_groups
So I have to go in and update
prisma.schema
by hand before running
prisma generate
r
When instrospecting, it is advisable to turn lowercased plural table into uppercase model name using
@@map
Also if you don't want to use the table and column names from your database in your Prisma Client API, you can configure them with `@map` and `@@map`: