Repository navigation
Open
Labels
bug/2-confirmedBug has been reproduced and confirmed.kind/bugA reported bug.tech/enginesIssue for tech Engines.topic: mysqltopic: prisma migrate devCLI: prisma migrate dev
Milestone
Description
Schema:
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
}
model comments {
id Int @id @default(autoincrement())
content String
}
Leads to this for me:
C:\Users\Jan\Documents\throwaway\11177>npx prisma migrate dev
Environment variables loaded from .env
Prisma schema loaded from prisma\schema.prisma
Datasource "db": MySQL database "sapphire_parakeet" at "mysql-db-provision.cm0mkpwj8arx.eu-central-1.rds.amazonaws.com:3306"
√ Enter a name for the new migration: ... first
Applying migration `20220114220406_first`
The following migration(s) have been created and applied from new schema changes:
migrations/
└─ 20220114220406_first/
└─ migration.sql
Your database is now in sync with your schema.
✔ Generated Prisma Client (3.8.1 | library) to .\node_modules\@prisma\client in 79ms
C:\Users\Jan\Documents\throwaway\11177>npx prisma migrate dev
Environment variables loaded from .env
Prisma schema loaded from prisma\schema.prisma
Datasource "db": MySQL database "sapphire_parakeet" at "mysql-db-provision.cm0mkpwj8arx.eu-central-1.rds.amazonaws.com: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 `foo` table
[+] Added column `content`
[+] Added column `id`
√ We need to reset the MySQL database "sapphire_parakeet" at "mysql-db-provision.cm0mkpwj8arx.eu-central-1.rds.amazonaws.com:3306".
Do you want to continue? All data will be lost. ... yes
Applying migration `20220114220406_first`
The following migration(s) have been applied:
migrations/
└─ 20220114220406_first/
└─ migration.sql
√ Enter a name for the new migration: ... second
Applying migration `20220114220430_second`
Error: P3018
A migration failed to apply. New migrations cannot be applied before the error is recovered from. Read more about how to resolve migration issues in a production database: https://pris.ly/d/migrate-resolve
Migration name: 20220114220430_second
Database error code: 1060
Database error:
Duplicate column name 'content'
Please check the query number 1 from the migration file.
Metadata
Metadata
Assignees
Labels
bug/2-confirmedBug has been reproduced and confirmed.kind/bugA reported bug.tech/enginesIssue for tech Engines.topic: mysqltopic: prisma migrate devCLI: prisma migrate dev
Activity
tomhoule commentedon Jan 17, 2022
I can't reproduce this behaviour (tried both prisma 3.5 and 3.8, on MySQL 8).
Do you still have the migration file?
janpio commentedon Jan 17, 2022
First:
Second:
tomhoule commentedon Jan 17, 2022
I managed to reproduce this by using the same internal database provisioning tool to create the MySQL database. My takeaway is that it is unclear whether it's a problem with the provisioning tool or migrate.