'use strict';
/** @type {import('sequelize-cli').Migration} */
module.exports = {
  async up (queryInterface, Sequelize) {
    await queryInterface.createTable('clients', {
      client_id: {
        allowNull: false,
        autoIncrement: true,
        primaryKey: true,
        type: Sequelize.DataTypes.INTEGER
      },
      first_name: {
        type: Sequelize.DataTypes.STRING(50),
        allowNull: false,
        comment: 'Имя клиента'
      },
      last_name: {
        type: Sequelize.DataTypes.STRING(50),
        allowNull: false,
        comment: 'Фамилия клиента'
      },
      phone_number: {
        type: Sequelize.DataTypes.STRING(20),
        allowNull: false,
        unique: true,
        comment: 'Номер телефона'
      },
      email: {
        type: Sequelize.DataTypes.STRING(100),
        allowNull: true,
        comment: 'Электронная почта'
      },
      registration_date: {
        type: Sequelize.DataTypes.DATE,
        allowNull: true,
        defaultValue: Sequelize.literal('CURRENT_TIMESTAMP'),
        comment: 'Дата регистрации'
      },
      notes: {
        type: Sequelize.DataTypes.TEXT,
        allowNull: true,
        comment: 'Заметки'
      }
    })
  },
  async down (queryInterface, Sequelize) {
    await queryInterface.dropTable('clients')
  }
}