'use strict';
/** @type {import('sequelize-cli').Migration} */
module.exports = {
  async up(queryInterface, Sequelize) {
    await queryInterface.createTable('payment', {
      id: {
        allowNull: false,
        autoIncrement: true,
        primaryKey: true,
        type: Sequelize.INTEGER
      },
      metode_pembayaran: {
        type: Sequelize.ENUM("cash", "transfer", "e-wallet"),
        allowNull: false
      },
      status_pembayaran: {
        type: Sequelize.ENUM("pending", "paid", "failed"),
        allowNull: false
      },
      order_id: {
        type: Sequelize.INTEGER,
        references :{
          model:"orders",
          key:"id"
        },
        allowNull: false
      },
      createdAt: {
        allowNull: false,
        type: Sequelize.DATE
      },
      updatedAt: {
        allowNull: false,
        type: Sequelize.DATE
      }
    });
  },
  async down(queryInterface, Sequelize) {
    await queryInterface.dropTable('payment');
  }
};