Files
stacks-blockchain-api/migrations/1605273328873_burnchain_rewards.js
2023-09-19 10:58:39 +01:00

42 lines
949 B
JavaScript

/** @param { import("node-pg-migrate").MigrationBuilder } pgm */
exports.up = pgm => {
pgm.createTable('burnchain_rewards', {
id: {
type: 'serial',
primaryKey: true,
},
canonical: {
type: 'boolean',
notNull: true,
},
burn_block_hash: {
type: 'bytea',
notNull: true,
},
burn_block_height: {
type: 'integer',
notNull: true,
},
burn_amount: {
type: 'numeric',
notNull: true,
},
reward_recipient: {
type: 'string',
notNull: true,
},
reward_amount: {
type: 'numeric',
notNull: true,
},
reward_index: {
type: 'integer',
notNull: true,
},
});
pgm.createIndex('burnchain_rewards', 'burn_block_hash', { method: 'hash' });
pgm.createIndex('burnchain_rewards', 'reward_recipient', { method: 'hash' });
pgm.createIndex('burnchain_rewards', [{ name: 'burn_block_height', sort: 'DESC' }]);
}