Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrate.js crash on index change #50

Open
JolivetteSax opened this issue Apr 19, 2019 · 0 comments
Open

migrate.js crash on index change #50

JolivetteSax opened this issue Apr 19, 2019 · 0 comments

Comments

@JolivetteSax
Copy link

JolivetteSax commented Apr 19, 2019

I have a model that blows up a diff migration because of a model with 2 indexes that haven't changed. It gets picked up as a diff but in the parsedifferences routine the rhs value is null so line 367 blows up. It seems I can only solve this by adding this check.

                    let index = _.clone(df.rhs);
                    // sometimes a diff is picked up with no RHS?
                    if (index)
                    {
                      index.actionType = 'addIndex';
                      index.tableName = tableName;
                      index.depends = [ tableName ];
                      actions.push(index);
                    }

This change makes the diff migration carry on and it seems to work fine. I've found that if I actually make a difference it also "works", but only one time. For example, I thought I fixed this by adding names to all my indexes.

My sequelize model has these indexes

    indexes: [
    {
      name: 'account_uuid_idx',
      unique: true,
      fields: ['uuid']
    },
    {
      name: 'account_username_btree_idx',
      method: 'BTREE',
      fields: ['username']
    }
    ]
  }```

Linux, node v10.15.3 , npm 6.8.0,  "sequelize-auto-migrations": "^1.0.3"

Thanks for your eyeballs!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant