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

Get empty params when makemigration #65

Closed
nvcken opened this issue Aug 28, 2019 · 4 comments
Closed

Get empty params when makemigration #65

nvcken opened this issue Aug 28, 2019 · 4 comments

Comments

@nvcken
Copy link

nvcken commented Aug 28, 2019

I got

var migrationCommands = [{
        fn: "createTable",
        params: [
            "account",
            {

            },
            {}
        ]
    },

with account models

/* eslint-disable key-spacing, no-multi-spaces */

module.exports = function (DB, { INTEGER, BIGINT, DATE, STRING, ENUM, BOOLEAN, DATEONLY, NOW }) {
  const Model = DB.define('account',
    {
      id:             { type: INTEGER,  allowNull: false, primaryKey: true, autoIncrement: true },
      test_param:     { type: BIGINT,  allowNull: false, defaultValue: 1000 },
      first_name:     { type: STRING,   allowNull: true, defaultValue: 'abc', field: 'first-name' },
      last_name:      { type: STRING,   allowNull: false, defaultValue: '' },
      nickname:       { type: STRING,   allowNull: false, defaultValue: '' },
      gender:         { type: ENUM,     allowNull: false, values: ['male', 'female', 'unknown'], defaultValue: 'unknown' },
      birth_date:     { type: DATEONLY, allowNull: true },
      last_login_dt:  { type: DATE,     allowNull: true },
      created_at:      { type: DATE,     allowNull: true, defaultValue: NOW },
      email:          { type: STRING,   allowNull: false, unique: true },
      password:       { type: STRING,   allowNull: false },
      is_deleted:     { type: BOOLEAN,  allowNull: false, defaultValue: false },
      is_blocked:     { type: BOOLEAN,  allowNull: false, defaultValue: false },
      // city_id -> city.id
    },
    {
      timestamps: false,
      underscored: true,
      tableName: 'account'
    }
  )

  Model.associate = (models) => {
    Model.belongsTo(models.city)
    // Model.hasMany(models.team, { foreignKey: { allowNull: false } })
  }

  return Model
}

occurs with "sequelize": "5.16.0" version

@nvcken
Copy link
Author

nvcken commented Aug 28, 2019

it works fine with "sequelize": "4.42.0"

@devanshug
Copy link

The issue should get fixed if the @flexxnn releases a new version in NPM. As this is solved in new merges.

@edrose
Copy link

edrose commented Sep 13, 2019

You can also install directly from git in the meantime.

npm i -D https://github.com/flexxnn/sequelize-auto-migrations.git

@nvcken
Copy link
Author

nvcken commented Sep 16, 2019

Thanks, It works

"devDependencies": {
    "sequelize-auto-migrations": "flexxnn/sequelize-auto-migrations",

@nvcken nvcken closed this as completed Sep 16, 2019
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

3 participants