mirror of
https://github.com/alexgo-io/stacks-blockchain-api.git
synced 2026-04-30 13:52:28 +08:00
* fix: move to tx_count * docs: add new transactions endpoint docs * fix: unused exports * feat: transactions per block * test: 404 on block
27 lines
540 B
JavaScript
27 lines
540 B
JavaScript
/* eslint-disable camelcase */
|
|
|
|
exports.shorthands = undefined;
|
|
|
|
exports.up = pgm => {
|
|
pgm.addColumns('blocks', {
|
|
tx_count: {
|
|
type: 'int',
|
|
default: 1,
|
|
},
|
|
});
|
|
pgm.sql(`
|
|
UPDATE blocks SET tx_count = (
|
|
SELECT COUNT(*)::int
|
|
FROM txs
|
|
WHERE index_block_hash = blocks.index_block_hash
|
|
AND canonical = TRUE
|
|
AND microblock_canonical = TRUE
|
|
)
|
|
`);
|
|
pgm.alterColumn('blocks', 'tx_count', { notNull: true });
|
|
};
|
|
|
|
exports.down = pgm => {
|
|
pgm.dropColumn('blocks', ['tx_count']);
|
|
};
|