James Pickard
11/23/2021, 1:49 PMnpx prisma db pull
and that seems to have updated my schema.prisma but it hasn’t generated a migration, I don’t thinkRyan
11/23/2021, 2:02 PMdb pull
will not generate a migration. Migrate commands like migrate dev
need to be run on adding an index to schema.prisma
.James Pickard
11/23/2021, 3:35 PMJames Pickard
11/23/2021, 3:35 PMJames Pickard
11/23/2021, 3:35 PMEnvironment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Datasource "db": MySQL database "deck-builder" at "localhost:3306"
Drift detected: Your database schema is not in sync with your migration history.
The following is a summary of the differences between the expected database schema given your migrations files, and the actual schema of the database.
It should be understood as the set of changes to get from the expected schema to the actual schema.
[*] Changed the `slide_decks` table
[+] Added unique index on columns (name)
James Pickard
11/23/2021, 3:36 PM✔ We need to reset the MySQL database "deck-builder" at "localhost:3306".
Do you want to continue? All data will be lost. … no
Ryan
11/24/2021, 5:00 AM@unique
and ran prisma migrate dev
. This is output and it doesn’t drop anything:James Pickard
11/24/2021, 7:39 AMprisma db pull
). Removing the index and running prisma migrate dev
seems to work. I’m guess I’m struggling with the correct dev workflow.James Pickard
11/24/2021, 7:40 AMprisma db pull
, remove the index, then run prisma migrate dev
Ryan
11/24/2021, 7:56 AMprisma db pull
in the first place. It’s just for development (prototyping) and not included in the Migrate flow. What you need to do is:
1. Add the index to the field in your schema.prisma
2. Run prisma migrate dev
(make sure no duplicate values exist on the field)
If you have duplicate values, you just need to remove them via a script before running prisma migrate dev
. The rest remains the same.James Pickard
11/24/2021, 10:27 AMschema.prisma
directly. The reason I used prisma db pull
is because it’s easier and more natural for me to add an index using MySQL syntax, or a GUI, than to figure out the prisma schema. It would be cool if this workflow were supported.James Pickard
11/24/2021, 10:29 AMRyan
11/24/2021, 12:05 PM