title: Sequelize CLI : cannot read property 'replace' of undefined when migrating DB
body: <p>I am trying to migrate DB using <code>db:migrate</code> function, however I am getting the error printed:</p>
  
  <blockquote>
    <p>ERROR: Cannot read property 'replace' of undefined</p>
  </blockquote>
  
  <p>I have referred to other solutions for this error on GitHub but none resolve the issue. I am using sequelize-cli to perform migration.</p>
  
  <p>here is my model:</p>
  
  <pre><code>    'use strict';
  module.exports = {
    up: (queryInterface, Sequelize) =&gt; {
      return queryInterface.createTable('Containers', {
        id: {
          allowNull: false,
          autoIncrement: true,
          primaryKey: true,
          type: Sequelize.INTEGER
        },
        name: {
          type: Sequelize.STRING
        },
        userId: {
            type: Sequelize.INTEGER,
            references: "Users",
            refereceKey: "id",
            onUpdate: "cascade",
            onDelete: "cascade",
        },
        type: {
          type: Sequelize.STRING
        },
        detail: {
          type: Sequelize.INTEGER
        },
        checkin: {
          type: Sequelize.DATE
        },
        checkout: {
          type: Sequelize.DATE
        },
        createdAt: {
          allowNull: false,
          type: Sequelize.DATE
        },
        updatedAt: {
          allowNull: false,
          type: Sequelize.DATE
        }
      });
    },
    down: (queryInterface, Sequelize) =&gt; {
      return queryInterface.dropTable('Containers');
    }
  };
  </code></pre>
  
  <p>I have tried to execute other models by deleting this and nothing seems to work. Please help me here!</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I have figured out that this is caused due to relations that I am trying to add, so I moved all the relations for all the posts in one separate migration:</p>
  
  <pre><code>    'use strict';
  
  module.exports = {
    up: (queryInterface, Sequelize) =&gt; {
      return [
          queryInterface.addColumn("Containers", "userId", {
              type: Sequelize.INTEGER,
              references: "Users",
              referenceKey: "id",
              onUpdate: "cascade",
              onDelete: "cascade"
          }),
  
          queryInterface.addColumn("Containers", "parentContainer", {
              type: Sequelize.INTEGER,
              references: "Containers",
              referenceKey: "id",
              onUpdate: "cascade",
              onDelete: "cascade"
          }),
  
          queryInterface.addColumn("Entities", "containerId", {
                type: Sequelize.INTEGER,
                references: "Containers",
                referenceKey: "id",
                onUpdate: "cascade",
                onDelete: "cascade",
          }),
  
          queryInterface.addColumn("Posts", "userId", {
                  type: Sequelize.INTEGER,
                  references: "Users",
                  referenceKey: "id",
                  onUpdate: "cascade",
                  onDelete: "cascade"
          }),
  
          queryInterface.addColumn("Posts", "containerId", {
                type: Sequelize.INTEGER,
                references: "Containers",
                referenceKey: "id",
                onUpdate: "cascade",
                onDelete: "cascade",
                nullable: true
          }),
  
          queryInterface.addColumn("Votes", "userId", {
                  type: Sequelize.INTEGER,
                  references: "Users",
                  referenceKey: "id",
                  onUpdate: "cascade",
                  onDelete: "cascade"
          }),
  
          queryInterface.addColumn("Votes", "postId", {
                  type: Sequelize.INTEGER,
                  references: "Posts",
                  referenceKey: "id",
                  onUpdate: "cascade",
                  onDelete: "cascade"
          }),
  
          queryInterface.addColumn("Comments", "userId", {
                  type: Sequelize.INTEGER,
                  references: "Users",
                  referenceKey: "id",
                  onUpdate: "cascade",
                  onDelete: "cascade"
          }),
  
          queryInterface.addColumn("Comments", "postId", {
                  type: Sequelize.INTEGER,
                  references: "Posts",
                  referenceKey: "id",
                  onUpdate: "cascade",
                  onDelete: "cascade"
          }),
  
          queryInterface.addColumn("Comments", "commentId", {
                  type: Sequelize.INTEGER,
                  references: "Comments",
                  referenceKey: "id",
                  onUpdate: "cascade",
                  onDelete: "cascade"
          }),
      ]
    },
  
    down: (queryInterface, Sequelize) =&gt; {
  
    }
  };
  </code></pre>
  
  <p>Now, all the tables are created BUT, the error persists for this migration.</p>