20220520125234-init-account.js 751 Bytes
'use strict';

module.exports = {
  async up (queryInterface, Sequelize) {
    const { UUID, DATE, STRING, TEXT, BOOLEAN, UUIDV1 } = Sequelize;
    await queryInterface.createTable('accounts', {
      id: {
        allowNull: false,
        primaryKey: true,
        type: UUID,
        defaultValue: UUIDV1,
      },
      address: { type: STRING, unique: true },
      balance: { type: STRING },
      publicKey: { type: STRING, unique: true },
      created_at: { type: DATE },
      updated_at: { type: DATE },
    });
  },

  async down (queryInterface, Sequelize) {
    /**
     * Add reverting commands here.
     *
     * Example:
     * await queryInterface.dropTable('users');
     */
     await queryInterface.dropTable('accounts');
  }
};