hemlock
hemlock
PPrisma
Created by hemlock on 9/10/2024 in #help-and-questions
Drift detected after migration reset
Hi, I'm having trouble with adding changes to our db because of Drift detected issue, event after. I did the ff migration reset --force

└─ 20240901165345_add_employee_soft_delete_field/
└─ migration.sql

✔ Generated Prisma Client (v5.19.1) to ./../../node_modules/@prisma/client in 210ms

✨ Done in 2.36s.

└─ 20240901165345_add_employee_soft_delete_field/
└─ migration.sql

✔ Generated Prisma Client (v5.19.1) to ./../../node_modules/@prisma/client in 210ms

✨ Done in 2.36s.
migration status
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Datasource "db": MySQL database "boardingpass_db" at "localhost:3306"

23 migrations found in prisma/migrations

Database schema is up to date!
✨ Done in 0.84s.
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Datasource "db": MySQL database "boardingpass_db" at "localhost:3306"

23 migrations found in prisma/migrations

Database schema is up to date!
✨ Done in 0.84s.
but if I run migration dev -n test_table_change I get the following error.
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Datasource "db": MySQL database "boardingpass_db" 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.

[+] Added tables
- Employee
- EmployeeRole

[*] Changed the `Employee` table
[+] Added foreign key on columns (tenant_id)
[+] Added foreign key on columns (user_id)

? We need to reset the MySQL database "boardingpass_db" at "localhost:3306"
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Datasource "db": MySQL database "boardingpass_db" 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.

[+] Added tables
- Employee
- EmployeeRole

[*] Changed the `Employee` table
[+] Added foreign key on columns (tenant_id)
[+] Added foreign key on columns (user_id)

? We need to reset the MySQL database "boardingpass_db" at "localhost:3306"
and I get the following errors from my mariadb container
database-1 | 2024-09-10 14:55:20 22 [ERROR] mariadbd: Incorrect information in file: './prisma_migrate_shadow_db_25d33d9d@002d7340@002d4d35@002da18b@002d57cf23569eab/employee.frm'
database-1 | 2024-09-10 14:55:20 22 [ERROR] mariadbd: Incorrect information in file: './prisma_migrate_shadow_db_25d33d9d@002d7340@002d4d35@002da18b@002d57cf23569eab/employeerole.frm'
database-1 | 2024-09-10 14:55:20 22 [ERROR] mariadbd: Incorrect information in file: './prisma_migrate_shadow_db_25d33d9d@002d7340@002d4d35@002da18b@002d57cf23569eab/employee.frm'
database-1 | 2024-09-10 14:55:20 22 [ERROR] mariadbd: Incorrect information in file: './prisma_migrate_shadow_db_25d33d9d@002d7340@002d4d35@002da18b@002d57cf23569eab/employeerole.frm'
prisma version is '5.16.2' and by binary targets: - "native", - "darwin", - "linux-arm64-openssl-1.0.x", - "rhel-openssl-1.0.x"
3 replies