question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

removeIndex not working with schema

See original GitHub issue

What are you doing?

module.exports = {
  up: (queryInterface, Sequelize) => {
    return queryInterface.addIndex({
      tableName: 'user',
      schema: 'core',
    }, [
      'username',
    ]);
  },

  down: (queryInterface, Sequelize) => {
    return queryInterface.removeIndex({
      tableName: 'user',
      schema: 'core',
    }, [
      'username',
    ]);
  },
};

To Reproduce Steps to reproduce the behavior:

  1. run migraion
  2. undo migration

What do you expect to happen?

add and remove index

What is actually happening?

index not removed

the query generated in wrong

 DROP INDEX IF EXISTS "[object _object]_username"

Environment

Dialect:

  • mysql
  • postgres
  • sqlite
  • mssql
  • any Dialect library version: 7.11.0 Database version: PostgreSQL 11.2, compiled by Visual C++ build 1914, 64-bit Sequelize version: 5.8.6 Node Version: 10.15.3 OS: Windows 10 If TypeScript related: TypeScript version: XXX Tested with latest release:
  • No
  • Yes, specify that version:

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:5
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
sm2017commented, Aug 1, 2019
 DROP INDEX IF EXISTS "core"."users_username"

OR

 DROP INDEX IF EXISTS core.users_username
0reactions
drinksbydrewcommented, Nov 16, 2022

Is there any progress on this issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Symfony Doctrine migrations : removeIndex not working
I'm using Symfony 1.4 with Doctrine. Here's my initial schema: Page: tableName: page columns: ref: type: string(50) notnull: true ...
Read more >
field_update_field() fails if a field schema removes an index ... - Drupal
The problem I'm experiencing is that when field_update_field() is called which should drop the old field table and re-create with the current schema, ......
Read more >
QueryInterface - Sequelize
If not specified, sequelize automatically creates a named constraint based on constraint type, table & column names. options.defaultValue, string. optional.
Read more >
Migration Operations - Django documentation
Django also uses these Operation objects to work out what your models looked like ... Does not affect the database, but persists these...
Read more >
Running a safe database migration using Postgres - Retool
Retool has navigated a lot of issues related to Postgres migrations. This post highlights lessons learned & how to avoid making the same ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found