Hi, I am starting with Prisma and I followed <http...
# orm-help
b
Hi, I am starting with Prisma and I followed https://www.prisma.io/docs/guides/database/developing-with-prisma-migrate/add-prisma-migrate-to-a-project#initialize-migration-history. 1. I ran prisma db pull 2. Change name of models and added @@map 3. Run prisma migrate dev --name initial-migration --create-only I expected prisma to generate migration file without any problems. Instead I have a message saying Drift detected with list of changes: 1. Added tables 2. Bunch of Added index , unique index etc across different table. Why there is a drift if I started with clean slate , generated prisma schema using DB Pull?
n
Hey Brothak 👋, Welcome to Prisma’s Slack! As you mentioned that you are using a production database and your data could not be reset, you would need to Baseline your production environment. Baselining tells Prisma Migrate to assume that one or more migrations have already been applied. Can you try this and check if it solves your issue?
b
Thanks I had a look there, but it’s bit confusing to me. I don’t have any migration and baselining seem to imply that I do? Also why there is a potential data lost when I running prisma migrate dev --name initial-migration --create-only. My understanding is that this would just create a migration file, in my case file for creating tables.
Because I don’t any migration I have nothing to pass as value to --applied which seems to be required.
@Nurul ^
n
Awesome! Let me know if you face any further issues, would be glad to help you out.
b
Thanks 🙂 just a quick question why does migrate even try to reset table with --create-only flag?
👀 1
n
The
--create-only
flag is supposed to just create the migration file, it doesn’t apply those migrations to the database. I don’t think it should reset the table. In this customizing migration guide it confirms the same.
1