'use strict';
module.exports = {
    up: (queryInterface, Sequelize) => {
        return queryInterface.createTable('GoodsFavourites', {
            id: {
                allowNull: false,
                autoIncrement: true,
                primaryKey: true,
                type: Sequelize.INTEGER
            },
            userId: {
              allowNull: false,
              type: Sequelize.INTEGER,
              onDelete: "CASCADE",
              references: {
                  model: 'Users',
                  key: 'id'
              }
            },
            goodsId: {
              allowNull: false,
              type: Sequelize.INTEGER,
              onDelete: "CASCADE",
              references: {
                  model: "GoodsAttributes",
                  key: 'id'
              }
            },
            createdAt: {
                allowNull: false,
                type: Sequelize.DATE,
                defaultValue: Sequelize.NOW
            },
            updatedAt: {
                allowNull: false,
                type: Sequelize.DATE
            }
        });
    },
    down: (queryInterface, Sequelize) => {
        return queryInterface.dropTable('GoodsFavourites');
    }
};
