'use strict';
/** @type {import('sequelize-cli').Migration} */
module.exports = {
  async up (queryInterface, Sequelize) {
    await queryInterface.createTable('equipment', {
      equipment_id: {
        allowNull: false,
        autoIncrement: true,
        primaryKey: true,
        type: Sequelize.DataTypes.INTEGER
      },
      item_name: {
        type: Sequelize.DataTypes.STRING(100),
        allowNull: false,
        comment: 'Название предмета'
      },
      category: {
        type: Sequelize.DataTypes.ENUM('camera', 'lens', 'light', 'background', 'other'),
        allowNull: false,
        comment: 'Категория оборудования'
      },
      serial_number: {
        type: Sequelize.DataTypes.STRING(50),
        allowNull: true,
        unique: true,
        comment: 'Серийный номер'
      },
      purchase_date: {
        type: Sequelize.DataTypes.DATEONLY,
        allowNull: true,
        comment: 'Дата покупки'
      },
      status: {
        type: Sequelize.DataTypes.ENUM('available', 'in_use', 'maintenance', 'broken'),
        allowNull: true,
        defaultValue: 'available',
        comment: 'Статус оборудования'
      }
    })
  },
  async down (queryInterface, Sequelize) {
    await queryInterface.dropTable('equipment')
  }
}