title: Sequelize Migration: relation <table> does not exist
body: <p>I'm working through an Author hasMany Books example and am attempting to run a sequelize-cli migration, but am getting the following issue when I run the following migration:</p>
  
  <pre><code>ERROR: relation "authors" does not exist
  </code></pre>
  
  <p>This is the first migration to create an author:</p>
  
  <pre><code>'use strict';
  module.exports = {
    up: (queryInterface, Sequelize) =&gt; {
      return queryInterface.createTable('Authors', {
        id: {
          allowNull: false,
          autoIncrement: true,
          primaryKey: true,
          type: Sequelize.INTEGER
        },
        firstName: {
          type: Sequelize.STRING
        },
        lastName: {
          type: Sequelize.STRING
        },
        dateOfBirth: {
          type: Sequelize.DATEONLY
        },
        dateOfDeath: {
          type: Sequelize.DATEONLY
        },
        createdAt: {
          allowNull: false,
          type: Sequelize.DATE
        },
        updatedAt: {
          allowNull: false,
          type: Sequelize.DATE
        }
      });
    },
    down: (queryInterface, Sequelize) =&gt; {
      return queryInterface.dropTable('Authors');
    }
  };
  </code></pre>
  
  <p>The second migration to create a book:</p>
  
  <pre><code>'use strict';
  module.exports = {
    up: (queryInterface, Sequelize) =&gt; {
      return queryInterface.createTable('Books', {
        id: {
          allowNull: false,
          autoIncrement: true,
          primaryKey: true,
          type: Sequelize.INTEGER
        },
        title: {
          type: Sequelize.STRING
        },
        summary: {
          type: Sequelize.STRING
        },
        isbn: {
          type: Sequelize.STRING
        },
        createdAt: {
          allowNull: false,
          type: Sequelize.DATE
        },
        updatedAt: {
          allowNull: false,
          type: Sequelize.DATE
        }
      });
    },
    down: (queryInterface, Sequelize) =&gt; {
      return queryInterface.dropTable('Books');
    }
  };
  </code></pre>
  
  <p>The migration to create the relationship between Author and Book:</p>
  
  <pre><code>'use strict';
  
  module.exports = {
    up: (queryInterface, Sequelize) =&gt; {
      return queryInterface.addColumn(
        'Books', // name of source model
        'AuthorId',
        {
          type: Sequelize.INTEGER,
          references: {
            model: 'authors',
            key: 'id'
          },
          onUpdate: 'CASCADE',
          onDelete: 'SET NULL'
        }
      )
    },
  
    down: (queryInterface, Sequelize) =&gt; {
      return queryInterface.removeColumn(
        'Books',
        'AuthorId'
      )
    }
  };
  </code></pre>
  
  <p>And these are my models:</p>
  
  <p>author.js:</p>
  
  <pre><code>'use strict';
  module.exports = (sequelize, DataTypes) =&gt; {
    var Author = sequelize.define('Author', {
      firstName: { type: DataTypes.STRING, allowNull: false, len: [2, 100] },
      lastName: { type: DataTypes.STRING, allowNull: false },
      dateOfBirth: { type: DataTypes.DATEONLY },
      dateOfDeath: { type: DataTypes.DATEONLY }
    }, {});
    Author.associate = function (models) {
      // associations can be defined here
      Author.hasMany(models.Book);
    };
    return Author;
  };
  </code></pre>
  
  <p>book.js:</p>
  
  <pre><code>'use strict';
  module.exports = (sequelize, DataTypes) =&gt; {
    var Book = sequelize.define('Book', {
      title: { type: DataTypes.STRING, allowNull: false, len: [2, 100], trim: true },
      summary: { type: DataTypes.STRING, allowNull: false },
      isbn: { type: DataTypes.STRING, allowNull: false }
    }, {});
  
    Book.associate = function (models) {
      // associations can be defined here
      Book.belongsTo(models.Author);
    };
    return Book;
  };
  </code></pre>
  
  <p>I've tried all sorts of things to no avail. My guess would be that it is attempting to alter the table in an asynchronous manner, but the previous migrations ran and finished:</p>
  
  <p><a href="https://i.stack.imgur.com/Nqlv9.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Nqlv9.png" alt="enter image description here"></a></p>
  
  <p>I'm using the following:</p>
  
  <pre><code>"pg": "^7.4.3"
  "sequelize": "^4.37.10"
  "sequelize-cli": "^4.0.0"
   "express": "~4.16.0"
  </code></pre>
  
  <p>I'm very new to sequelize and any help would be appreciated!</p>