Skip to content

Renaming column removes reference when using sqlite #6205

Closed

Description

@lrills

It seems only table schema is copied while constructing new table, neither do index and reference.
https://github.com/sequelize/sequelize/blob/master/lib/dialects/sqlite/query-interface.js#L94

What you are doing?

Using renameColumn in migration with cli, happened when test with sqlite.

export default {
  up(queryInterface) {
    return queryInterface.renameColumn('mytable', 'updated_at', 'registered_at');
  },
  down(queryInterface) {
    return queryInterface.renameColumn('mytable', 'registered_at', 'updated_at');
  },
};

What do you expect to happen?

Reference remain still.

What is actually happening?

Reference gone, this is comparison to schema generated by sync:

      -    "foreignKeyList": []
      +    "foreignKeyList":[
      +       {
      +        "from": "band_id"
      +        "match": "NONE"
      +        "on_delete": "CASCADE"
      +        "on_update": "CASCADE"
      +        "seq": 0
      +        "table": "bands"
      +        "to": "id"
      +      }
      +    ]

Dialect: sqlite
Database version: 3.8.10.2
Sequelize version: 3.23.3

Activity

  1. added
    type: bug
    dialect: sqlite
    on Jul 3, 2016
  2. sushantdhiman commented on Jul 3, 2016

    @sushantdhiman
    Contributor

    Related #2033

  3. sushantdhiman commented on Jan 10, 2017

    @sushantdhiman
    Contributor

    Moved to #7078

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    dialect: sqlitetype: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions