You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I run the first command to push my schema to db as the following:
npx prisma db push
then I did an update on the following model:
modelProject {@@map("projects")idString@id@default(uuid())nameStringtestIdString?// added this columnaccountIdString@map("account_id")createdAtDateTime?@default(now())@map("created_at")updatedAtDateTime?@updatedAt@default(now())@map("updated_at")@@schema("server")}
then I run the following command:
npx prisma migrate dev
it fails with the following error:
Error: P3006
Migration `20221016115041_project_update` failed to apply cleanly to the shadow database.
Error:
db error: ERROR: relation "users" already exists
0: sql_migration_connector::validate_migrations
at migration-engine/connectors/sql-migration-connector/src/lib.rs:289
1: migration_core::state::DevDiagnostic
at migration-engine/core/src/state.rs:251
when I looked on the generated migration script I found that prisma regenerates the migration for the whole schema even the not changed tables!
that's why it outputs this error
Also I don't know why the generated migration script doesn't have CREATE IF NOT EXIST instead of CREATE
because this may fail also!
How to reproduce
Expected behavior
No response
Prisma information
Error: P3006
Migration 20221016115041_project_update failed to apply cleanly to the shadow database.
Error:
db error: ERROR: relation "users" already exists
0: sql_migration_connector::validate_migrations
at migration-engine/connectors/sql-migration-connector/src/lib.rs:289
1: migration_core::state::DevDiagnostic
at migration-engine/core/src/state.rs:251
Environment & setup
OS: Ubuntu
Database: PostgreSQL
Node.js version: 17
Prisma Version
4.3.1
The text was updated successfully, but these errors were encountered:
Bug description
I have the following schema
I run the first command to push my schema to db as the following:
then I did an update on the following model:
then I run the following command:
it fails with the following error:
when I looked on the generated migration script I found that prisma regenerates the migration for the whole schema even the not changed tables!
that's why it outputs this error
Also I don't know why the generated migration script doesn't have CREATE IF NOT EXIST instead of CREATE
because this may fail also!
How to reproduce
Expected behavior
No response
Prisma information
Error: P3006
Migration
20221016115041_project_update
failed to apply cleanly to the shadow database.Error:
db error: ERROR: relation "users" already exists
0: sql_migration_connector::validate_migrations
at migration-engine/connectors/sql-migration-connector/src/lib.rs:289
1: migration_core::state::DevDiagnostic
at migration-engine/core/src/state.rs:251
Environment & setup
Prisma Version
The text was updated successfully, but these errors were encountered: