'use strict';
module.exports = {
    up: (queryInterface, Sequelize) => {
        return queryInterface.createTable('GoodsAttributes', {
            id: {
                allowNull: false,
                autoIncrement: true,
                primaryKey: true,
                type: Sequelize.INTEGER
            },
            imgUrlArray: {
                allowNull: false,
                type: Sequelize.ARRAY(Sequelize.TEXT)
            },
            goodsId: {
                allowNull: false,
                type: Sequelize.INTEGER,
                onDelete: 'CASCADE',
                references: {
                    model: 'Goods',
                    key: 'id'
                }
            },
            nameAttribute: {
              allowNull: false,
              type: Sequelize.STRING
            },
            valueAttribute: {
              allowNull: false,
              type: Sequelize.STRING
            },
            price: {
                allowNull: false,
                type: Sequelize.FLOAT
            },
            createdAt: {
                allowNull: false,
                type: Sequelize.DATE,
                defaultValue: Sequelize.NOW
            },
            updatedAt: {
                allowNull: false,
                type: Sequelize.DATE
            }
        });
    },
    down: (queryInterface, Sequelize) => {
        return queryInterface.dropTable('GoodsAttributes');
    }
};
