'use strict'

module.exports = {
  up: (queryInterface, Sequelize) => {
    return queryInterface.createTable(
      'Mappings_Samples',
      {
        instrumentMappingId: {
          type: Sequelize.UUID,
          primaryKey: 'mapping_sample_pkey'
        },
        sampleId: {
          type: Sequelize.UUID,
          primaryKey: 'mapping_sample_pkey'
        }
      }
    )
  },

  down: (queryInterface, Sequelize) => {
    return queryInterface.dropTable('Mappings_Samples', {})
  }
}

'use strict'

module.exports = {
  up: (queryInterface, Sequelize) => {
    return queryInterface.createTable(
      'Mappings_Samples',
      {
        instrumentMappingId: {
          type: Sequelize.UUID,
          primaryKey: 'mapping_sample_pkey',
          references: {
            model: 'InstrumentMappings',
            key: 'id'
          }
        },
        sampleId: {
          type: Sequelize.UUID,
          primaryKey: 'mapping_sample_pkey',
          references: {
            model: 'Samples',
            key: 'id'
          }
        }
      }
    )
  },

  down: (queryInterface, Sequelize) => {
    return queryInterface.dropTable('Mappings_Samples', {})
  }
}

Fix missing foreign key references in InstrumentMapping/Sample join table.
Fix missing foreign key references in InstrumentMapping/Sample join table.

In order to update the database:
1) do `sequelize db:migrate:undo`
2) do `sequelize db:migrate`
