'use strict';
/** @type {import('sequelize-cli').Migration} */
module.exports = {
  async up(queryInterface, Sequelize) {
    await queryInterface.createTable('PaymentMethods', {
      id: {
        allowNull: false,
        autoIncrement: true,
        primaryKey: true,
        type: Sequelize.INTEGER
      },
      userId: {
        type: Sequelize.INTEGER
      },
      type: {
        type: Sequelize.ENUM('credit_card', 'debit_card', 'paypal', 'bank_transfer', 'mobile_money', 'crypto')
      },
      provider: {
        type: Sequelize.STRING
      },
      token: {
        type: Sequelize.STRING
      },
      last4: {
        type: Sequelize.STRING
      },
      expiryMonth: {
        type: Sequelize.INTEGER
      },
      expiryYear: {
        type: Sequelize.INTEGER
      },
      isDefault: {
        type: Sequelize.BOOLEAN
      },
      createdAt: {
        allowNull: false,
        type: Sequelize.DATE
      },
      updatedAt: {
        allowNull: false,
        type: Sequelize.DATE
      }
    });
  },
  async down(queryInterface, Sequelize) {
    await queryInterface.dropTable('PaymentMethods');
  }
};