title: Sequelize: Naming collision between attribute 'playlist' and association 'playlist'?
body: <p>I am using node.js, Sequelize and MariaDB and I am running into the following error, which I am not sure how to resolve?</p>
  
  <blockquote>
    <p>Error: Naming collision between attribute 'playlist' and association
    'playlist' on model playlist_entry. To remedy this, change either foreignKey
    or as in your association definition</p>
  </blockquote>
  
  <p>My Javascript:</p>
  
  <pre><code>Entities = function (settings, context) {
  
      sequelize = context.sequelize;
  
      var entities = {
  
          Playlist: this.sequelize.define('playlist', {
              name: Sequelize.STRING,
              description: Sequelize.STRING
          }),     
  
          PlaylistEntry: this.sequelize.define('playlist_entry', {
              playlist: Sequelize.INTEGER
              //track: Sequelize.INTEGER
          })
  
      };  
  
       entities.PlaylistEntry.belongsTo(
           entities.Playlist,
           { foreignKey: { name: 'fk_playlist' }});
  
      return entities;                    
  }
  </code></pre>
  
  <p>My tables:</p>
  
  <pre><code>CREATE TABLE `playlist` (
    `id` int(11) unsigned NOT NULL,
    `name` varchar(255) NOT NULL,
    `description` varchar(255) DEFAULT NULL,
    `createdAt` timestamp NULL DEFAULT NULL,
    `updatedAt` timestamp NULL DEFAULT NULL,
    `external_id` int(11) DEFAULT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `id` (`id`)
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  
  CREATE TABLE `playlist_entry` (
    `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
    `playlist` int(11) unsigned DEFAULT NULL,
    `track` int(11) unsigned DEFAULT NULL,
    `createdAt` timestamp NULL DEFAULT NULL,
    `updatedat` timestamp NULL DEFAULT NULL,
    PRIMARY KEY (`id`),
    KEY `track_idx` (`track`),
    KEY `playlist_idx` (`playlist`),
    CONSTRAINT `fk_playlist` FOREIGN KEY (`playlist`) REFERENCES `playlist` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
  ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
  </code></pre>