Skip to content

Indexing error when run migration again #6873

@macalex

Description

@macalex

Bug description

When I create a new migration I get this Error message

Error: Database error
Error querying the database: Server error: `ERROR 42000 (1061): Duplicate key name 'accounts_id_with_roles_id_index''
   0: migration_core::api::ApplyMigrations
             at migration-engine/core/src/api.rs:73

But this index wasn't modified. Yet it tries to define the index again and the put the connected line into the new migration file.
Why?

How to reproduce

Steps to reproduce the behavior:
https://bitbucket.org/AlexSzekely/prsm/src/master/

Expected behavior

If the index exists in the migration, you shouldn't write index into the next migration file again.

Prisma information

You can find it on the bitbucket.

Environment & setup

  • OS: Mac OS
  • Database: MySQL
  • Node.js version: v14.15.4
  • Prisma version:
prisma               : 2.21.2
@prisma/client       : 2.21.2
Current platform     : darwin
Query Engine         : query-engine e421996c87d5f3c8f7eeadd502d4ad402c89464d (at ../../../../../../usr/local/lib/node_modules/prisma/node_modules/@prisma/engines/query-engine-darwin)
Migration Engine     : migration-engine-cli e421996c87d5f3c8f7eeadd502d4ad402c89464d (at ../../../../../../usr/local/lib/node_modules/prisma/node_modules/@prisma/engines/migration-engine-darwin)
Introspection Engine : introspection-core e421996c87d5f3c8f7eeadd502d4ad402c89464d (at ../../../../../../usr/local/lib/node_modules/prisma/node_modules/@prisma/engines/introspection-engine-darwin)
Format Binary        : prisma-fmt e421996c87d5f3c8f7eeadd502d4ad402c89464d (at ../../../../../../usr/local/lib/node_modules/prisma/node_modules/@prisma/engines/prisma-fmt-darwin)
Default Engines Hash : e421996c87d5f3c8f7eeadd502d4ad402c89464d
Studio               : 0.371.0

Metadata

Metadata

Assignees

Labels

bug/1-unconfirmedBug should have enough information for reproduction, but confirmation has not happened yet.kind/bugA reported bug.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions