mirror of
https://github.com/alexgo-io/stacks-blockchain-api.git
synced 2026-01-12 08:34:40 +08:00
fix: revert configurable DB index type
This commit is contained in:
@@ -1,7 +1,4 @@
|
||||
/** @param { import("node-pg-migrate").MigrationBuilder } pgm */
|
||||
|
||||
const INDEX_METHOD = process.env.PG_IDENT_INDEX_TYPE;
|
||||
|
||||
exports.up = pgm => {
|
||||
pgm.createTable('blocks', {
|
||||
index_block_hash: {
|
||||
@@ -74,9 +71,9 @@ exports.up = pgm => {
|
||||
},
|
||||
});
|
||||
|
||||
pgm.createIndex('blocks', 'block_hash', { method: INDEX_METHOD });
|
||||
pgm.createIndex('blocks', 'burn_block_hash', { method: INDEX_METHOD });
|
||||
pgm.createIndex('blocks', 'index_block_hash', { method: INDEX_METHOD });
|
||||
pgm.createIndex('blocks', 'block_hash', { method: 'hash' });
|
||||
pgm.createIndex('blocks', 'burn_block_hash', { method: 'hash' });
|
||||
pgm.createIndex('blocks', 'index_block_hash', { method: 'hash' });
|
||||
pgm.createIndex('blocks', [{ name: 'block_height', sort: 'DESC' }]);
|
||||
pgm.createIndex('blocks', [{ name: 'burn_block_height', sort: 'DESC' }]);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
/** @param { import("node-pg-migrate").MigrationBuilder } pgm */
|
||||
|
||||
const INDEX_METHOD = process.env.PG_IDENT_INDEX_TYPE;
|
||||
|
||||
exports.up = pgm => {
|
||||
pgm.createTable('txs', {
|
||||
id: {
|
||||
@@ -167,15 +164,15 @@ exports.up = pgm => {
|
||||
coinbase_alt_recipient: 'string',
|
||||
});
|
||||
|
||||
pgm.createIndex('txs', 'tx_id', { method: INDEX_METHOD });
|
||||
pgm.createIndex('txs', 'contract_call_contract_id', { method: INDEX_METHOD });
|
||||
pgm.createIndex('txs', 'index_block_hash', { method: INDEX_METHOD });
|
||||
pgm.createIndex('txs', 'microblock_hash', { method: INDEX_METHOD });
|
||||
pgm.createIndex('txs', 'sender_address', { method: INDEX_METHOD });
|
||||
pgm.createIndex('txs', 'smart_contract_contract_id', { method: INDEX_METHOD });
|
||||
pgm.createIndex('txs', 'sponsor_address', { method: INDEX_METHOD });
|
||||
pgm.createIndex('txs', 'token_transfer_recipient_address', { method: INDEX_METHOD });
|
||||
pgm.createIndex('txs', 'coinbase_alt_recipient', { method: INDEX_METHOD });
|
||||
pgm.createIndex('txs', 'tx_id', { method: 'hash' });
|
||||
pgm.createIndex('txs', 'contract_call_contract_id', { method: 'hash' });
|
||||
pgm.createIndex('txs', 'index_block_hash', { method: 'hash' });
|
||||
pgm.createIndex('txs', 'microblock_hash', { method: 'hash' });
|
||||
pgm.createIndex('txs', 'sender_address', { method: 'hash' });
|
||||
pgm.createIndex('txs', 'smart_contract_contract_id', { method: 'hash' });
|
||||
pgm.createIndex('txs', 'sponsor_address', { method: 'hash' });
|
||||
pgm.createIndex('txs', 'token_transfer_recipient_address', { method: 'hash' });
|
||||
pgm.createIndex('txs', 'coinbase_alt_recipient');
|
||||
pgm.createIndex('txs', 'type_id');
|
||||
pgm.createIndex('txs', [{ name: 'tx_index', sort: 'DESC' }]);
|
||||
pgm.createIndex('txs', [
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
/** @param { import("node-pg-migrate").MigrationBuilder } pgm */
|
||||
|
||||
const INDEX_METHOD = process.env.PG_IDENT_INDEX_TYPE;
|
||||
|
||||
exports.up = pgm => {
|
||||
pgm.createTable('stx_events', {
|
||||
id: {
|
||||
@@ -61,11 +58,11 @@ exports.up = pgm => {
|
||||
memo: 'bytea',
|
||||
});
|
||||
|
||||
pgm.createIndex('stx_events', 'tx_id', { method: INDEX_METHOD });
|
||||
pgm.createIndex('stx_events', 'index_block_hash', { method: INDEX_METHOD });
|
||||
pgm.createIndex('stx_events', 'microblock_hash', { method: INDEX_METHOD });
|
||||
pgm.createIndex('stx_events', 'sender', { method: INDEX_METHOD });
|
||||
pgm.createIndex('stx_events', 'recipient', { method: INDEX_METHOD });
|
||||
pgm.createIndex('stx_events', 'tx_id', { method: 'hash' });
|
||||
pgm.createIndex('stx_events', 'index_block_hash', { method: 'hash' });
|
||||
pgm.createIndex('stx_events', 'microblock_hash', { method: 'hash' });
|
||||
pgm.createIndex('stx_events', 'sender', { method: 'hash' });
|
||||
pgm.createIndex('stx_events', 'recipient', { method: 'hash' });
|
||||
pgm.createIndex('stx_events', 'event_index');
|
||||
pgm.createIndex('stx_events', [{ name: 'block_height', sort: 'DESC' }]);
|
||||
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
/** @param { import("node-pg-migrate").MigrationBuilder } pgm */
|
||||
|
||||
const INDEX_METHOD = process.env.PG_IDENT_INDEX_TYPE;
|
||||
|
||||
exports.up = pgm => {
|
||||
pgm.createTable('ft_events', {
|
||||
id: {
|
||||
@@ -64,11 +61,11 @@ exports.up = pgm => {
|
||||
recipient: 'string',
|
||||
});
|
||||
|
||||
pgm.createIndex('ft_events', 'tx_id', { method: INDEX_METHOD });
|
||||
pgm.createIndex('ft_events', 'index_block_hash', { method: INDEX_METHOD });
|
||||
pgm.createIndex('ft_events', 'microblock_hash', { method: INDEX_METHOD });
|
||||
pgm.createIndex('ft_events', 'sender', { method: INDEX_METHOD });
|
||||
pgm.createIndex('ft_events', 'recipient', { method: INDEX_METHOD });
|
||||
pgm.createIndex('ft_events', 'tx_id', { method: 'hash' });
|
||||
pgm.createIndex('ft_events', 'index_block_hash', { method: 'hash' });
|
||||
pgm.createIndex('ft_events', 'microblock_hash', { method: 'hash' });
|
||||
pgm.createIndex('ft_events', 'sender', { method: 'hash' });
|
||||
pgm.createIndex('ft_events', 'recipient', { method: 'hash' });
|
||||
pgm.createIndex('ft_events', 'event_index');
|
||||
pgm.createIndex('ft_events', [{ name: 'block_height', sort: 'DESC' }]);
|
||||
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
/** @param { import("node-pg-migrate").MigrationBuilder } pgm */
|
||||
|
||||
const INDEX_METHOD = process.env.PG_IDENT_INDEX_TYPE;
|
||||
|
||||
exports.up = pgm => {
|
||||
pgm.createTable('nft_events', {
|
||||
id: {
|
||||
@@ -64,11 +61,11 @@ exports.up = pgm => {
|
||||
recipient: 'string',
|
||||
});
|
||||
|
||||
pgm.createIndex('nft_events', 'tx_id', { method: INDEX_METHOD });
|
||||
pgm.createIndex('nft_events', 'index_block_hash', { method: INDEX_METHOD });
|
||||
pgm.createIndex('nft_events', 'microblock_hash', { method: INDEX_METHOD });
|
||||
pgm.createIndex('nft_events', 'sender', { method: INDEX_METHOD });
|
||||
pgm.createIndex('nft_events', 'recipient', { method: INDEX_METHOD });
|
||||
pgm.createIndex('nft_events', 'tx_id', { method: 'hash' });
|
||||
pgm.createIndex('nft_events', 'index_block_hash', { method: 'hash' });
|
||||
pgm.createIndex('nft_events', 'microblock_hash', { method: 'hash' });
|
||||
pgm.createIndex('nft_events', 'sender', { method: 'hash' });
|
||||
pgm.createIndex('nft_events', 'recipient', { method: 'hash' });
|
||||
pgm.createIndex('nft_events', 'event_index');
|
||||
pgm.createIndex('nft_events', ['asset_identifier', 'value']);
|
||||
pgm.createIndex('nft_events', 'asset_identifier', { where: 'asset_event_type_id = 2', method: 'hash' }); // Mints
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
/** @param { import("node-pg-migrate").MigrationBuilder } pgm */
|
||||
|
||||
const INDEX_METHOD = process.env.PG_IDENT_INDEX_TYPE;
|
||||
|
||||
exports.up = pgm => {
|
||||
pgm.createTable('contract_logs', {
|
||||
id: {
|
||||
@@ -62,8 +59,8 @@ exports.up = pgm => {
|
||||
},
|
||||
});
|
||||
|
||||
pgm.createIndex('contract_logs', 'tx_id', { method: INDEX_METHOD });
|
||||
pgm.createIndex('contract_logs', 'index_block_hash', { method: INDEX_METHOD });
|
||||
pgm.createIndex('contract_logs', 'microblock_hash', { method: INDEX_METHOD });
|
||||
pgm.createIndex('contract_logs', 'tx_id', { method: 'hash' });
|
||||
pgm.createIndex('contract_logs', 'index_block_hash', { method: 'hash' });
|
||||
pgm.createIndex('contract_logs', 'microblock_hash', { method: 'hash' });
|
||||
pgm.createIndex('contract_logs', 'event_index');
|
||||
}
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
/** @param { import("node-pg-migrate").MigrationBuilder } pgm */
|
||||
|
||||
const INDEX_METHOD = process.env.PG_IDENT_INDEX_TYPE;
|
||||
|
||||
exports.up = pgm => {
|
||||
pgm.createTable('smart_contracts', {
|
||||
id: {
|
||||
@@ -57,7 +54,7 @@ exports.up = pgm => {
|
||||
},
|
||||
});
|
||||
|
||||
pgm.createIndex('smart_contracts', 'index_block_hash', { method: INDEX_METHOD });
|
||||
pgm.createIndex('smart_contracts', 'microblock_hash', { method: INDEX_METHOD });
|
||||
pgm.createIndex('smart_contracts', 'contract_id', { method: INDEX_METHOD });
|
||||
pgm.createIndex('smart_contracts', 'index_block_hash', { method: 'hash' });
|
||||
pgm.createIndex('smart_contracts', 'microblock_hash', { method: 'hash' });
|
||||
pgm.createIndex('smart_contracts', 'contract_id', { method: 'hash' });
|
||||
}
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
/** @param { import("node-pg-migrate").MigrationBuilder } pgm */
|
||||
|
||||
const INDEX_METHOD = process.env.PG_IDENT_INDEX_TYPE;
|
||||
|
||||
exports.up = pgm => {
|
||||
pgm.createTable('faucet_requests', {
|
||||
id: {
|
||||
@@ -26,5 +23,5 @@ exports.up = pgm => {
|
||||
},
|
||||
});
|
||||
|
||||
pgm.createIndex('faucet_requests', 'address', { method: INDEX_METHOD });
|
||||
pgm.createIndex('faucet_requests', 'address', { method: 'hash' });
|
||||
}
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
/** @param { import("node-pg-migrate").MigrationBuilder } pgm */
|
||||
|
||||
const INDEX_METHOD = process.env.PG_IDENT_INDEX_TYPE;
|
||||
|
||||
exports.up = pgm => {
|
||||
pgm.createTable('mempool_txs', {
|
||||
id: {
|
||||
@@ -106,13 +103,13 @@ exports.up = pgm => {
|
||||
}
|
||||
});
|
||||
|
||||
pgm.createIndex('mempool_txs', 'tx_id', { method: INDEX_METHOD });
|
||||
pgm.createIndex('mempool_txs', 'contract_call_contract_id', { method: INDEX_METHOD });
|
||||
pgm.createIndex('mempool_txs', 'tx_id', { method: 'hash' });
|
||||
pgm.createIndex('mempool_txs', 'contract_call_contract_id', { method: 'hash' });
|
||||
pgm.createIndex('mempool_txs', 'nonce');
|
||||
pgm.createIndex('mempool_txs', 'sender_address', { method: INDEX_METHOD });
|
||||
pgm.createIndex('mempool_txs', 'smart_contract_contract_id', { method: INDEX_METHOD });
|
||||
pgm.createIndex('mempool_txs', 'sponsor_address', { method: INDEX_METHOD });
|
||||
pgm.createIndex('mempool_txs', 'token_transfer_recipient_address', { method: INDEX_METHOD });
|
||||
pgm.createIndex('mempool_txs', 'sender_address', { method: 'hash' });
|
||||
pgm.createIndex('mempool_txs', 'smart_contract_contract_id', { method: 'hash' });
|
||||
pgm.createIndex('mempool_txs', 'sponsor_address', { method: 'hash' });
|
||||
pgm.createIndex('mempool_txs', 'token_transfer_recipient_address', { method: 'hash' });
|
||||
pgm.createIndex('mempool_txs', [{ name: 'receipt_time', sort: 'DESC' }]);
|
||||
pgm.createIndex('mempool_txs', ['type_id', 'receipt_block_height'], { where: 'pruned = false'});
|
||||
pgm.createIndex('mempool_txs', ['type_id', 'fee_rate'], { where: 'pruned = false'});
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
/** @param { import("node-pg-migrate").MigrationBuilder } pgm */
|
||||
|
||||
const INDEX_METHOD = process.env.PG_IDENT_INDEX_TYPE;
|
||||
|
||||
exports.up = pgm => {
|
||||
pgm.createTable('stx_lock_events', {
|
||||
id: {
|
||||
@@ -72,10 +69,10 @@ exports.up = pgm => {
|
||||
{ name: 'tx_index', sort: 'DESC' },
|
||||
]);
|
||||
|
||||
pgm.createIndex('stx_lock_events', 'tx_id', { method: INDEX_METHOD });
|
||||
pgm.createIndex('stx_lock_events', 'index_block_hash', { method: INDEX_METHOD });
|
||||
pgm.createIndex('stx_lock_events', 'microblock_hash', { method: INDEX_METHOD });
|
||||
pgm.createIndex('stx_lock_events', 'locked_address', { method: INDEX_METHOD });
|
||||
pgm.createIndex('stx_lock_events', 'tx_id', { method: 'hash' });
|
||||
pgm.createIndex('stx_lock_events', 'index_block_hash', { method: 'hash' });
|
||||
pgm.createIndex('stx_lock_events', 'microblock_hash', { method: 'hash' });
|
||||
pgm.createIndex('stx_lock_events', 'locked_address', { method: 'hash' });
|
||||
pgm.createIndex('stx_lock_events', [{ name: 'block_height', sort: 'DESC' }]);
|
||||
pgm.createIndex('stx_lock_events', [{ name: 'unlock_height', sort: 'DESC' }]);
|
||||
pgm.createIndex('stx_lock_events', 'contract_name');
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
/** @param { import("node-pg-migrate").MigrationBuilder } pgm */
|
||||
|
||||
const INDEX_METHOD = process.env.PG_IDENT_INDEX_TYPE;
|
||||
|
||||
exports.up = pgm => {
|
||||
pgm.createTable('miner_rewards', {
|
||||
id: {
|
||||
@@ -53,8 +50,8 @@ exports.up = pgm => {
|
||||
}
|
||||
});
|
||||
|
||||
pgm.createIndex('miner_rewards', 'index_block_hash', { method: INDEX_METHOD });
|
||||
pgm.createIndex('miner_rewards', 'recipient', { method: INDEX_METHOD });
|
||||
pgm.createIndex('miner_rewards', 'index_block_hash', { method: 'hash' });
|
||||
pgm.createIndex('miner_rewards', 'recipient', { method: 'hash' });
|
||||
pgm.createIndex('miner_rewards', 'miner_address');
|
||||
pgm.createIndex('miner_rewards', [{ name: 'mature_block_height', sort: 'DESC' }]);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
/** @param { import("node-pg-migrate").MigrationBuilder } pgm */
|
||||
|
||||
const INDEX_METHOD = process.env.PG_IDENT_INDEX_TYPE;
|
||||
|
||||
exports.up = pgm => {
|
||||
pgm.createTable('burnchain_rewards', {
|
||||
id: {
|
||||
@@ -38,7 +35,7 @@ exports.up = pgm => {
|
||||
},
|
||||
});
|
||||
|
||||
pgm.createIndex('burnchain_rewards', 'burn_block_hash', { method: INDEX_METHOD });
|
||||
pgm.createIndex('burnchain_rewards', 'reward_recipient', { method: INDEX_METHOD });
|
||||
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' }]);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
/** @param { import("node-pg-migrate").MigrationBuilder } pgm */
|
||||
|
||||
const INDEX_METHOD = process.env.PG_IDENT_INDEX_TYPE;
|
||||
|
||||
exports.up = pgm => {
|
||||
pgm.createTable('namespaces', {
|
||||
id: {
|
||||
@@ -91,7 +88,7 @@ exports.up = pgm => {
|
||||
},
|
||||
});
|
||||
|
||||
pgm.createIndex('namespaces', 'index_block_hash', { method: INDEX_METHOD });
|
||||
pgm.createIndex('namespaces', 'index_block_hash');
|
||||
pgm.createIndex('namespaces', [
|
||||
{ name: 'ready_block', sort: 'DESC' },
|
||||
{ name: 'microblock_sequence', sort: 'DESC' },
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
/** @param { import("node-pg-migrate").MigrationBuilder } pgm */
|
||||
|
||||
const INDEX_METHOD = process.env.PG_IDENT_INDEX_TYPE;
|
||||
|
||||
exports.up = pgm => {
|
||||
pgm.createTable('names', {
|
||||
id: {
|
||||
@@ -84,8 +81,8 @@ exports.up = pgm => {
|
||||
},
|
||||
});
|
||||
|
||||
pgm.createIndex('names', 'namespace_id', { method: INDEX_METHOD });
|
||||
pgm.createIndex('names', 'index_block_hash', { method: INDEX_METHOD });
|
||||
pgm.createIndex('names', 'namespace_id');
|
||||
pgm.createIndex('names', 'index_block_hash');
|
||||
pgm.createIndex('names', [
|
||||
{ name: 'registered_at', sort: 'DESC' },
|
||||
{ name: 'microblock_sequence', sort: 'DESC' },
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
/** @param { import("node-pg-migrate").MigrationBuilder } pgm */
|
||||
|
||||
const INDEX_METHOD = process.env.PG_IDENT_INDEX_TYPE;
|
||||
|
||||
exports.up = pgm => {
|
||||
pgm.createTable('subdomains', {
|
||||
id: {
|
||||
@@ -83,8 +80,8 @@ exports.up = pgm => {
|
||||
},
|
||||
});
|
||||
|
||||
pgm.createIndex('subdomains', 'name', { method: INDEX_METHOD });
|
||||
pgm.createIndex('subdomains', 'index_block_hash', { method: INDEX_METHOD });
|
||||
pgm.createIndex('subdomains', 'name');
|
||||
pgm.createIndex('subdomains', 'index_block_hash');
|
||||
pgm.createIndex('subdomains', [
|
||||
{ name: 'block_height', sort: 'DESC' },
|
||||
{ name: 'microblock_sequence', sort: 'DESC' },
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
/** @param { import("node-pg-migrate").MigrationBuilder } pgm */
|
||||
|
||||
const INDEX_METHOD = process.env.PG_IDENT_INDEX_TYPE;
|
||||
|
||||
exports.up = pgm => {
|
||||
pgm.createTable('reward_slot_holders', {
|
||||
id: {
|
||||
@@ -30,6 +27,6 @@ exports.up = pgm => {
|
||||
},
|
||||
});
|
||||
|
||||
pgm.createIndex('reward_slot_holders', 'burn_block_hash', { method: INDEX_METHOD });
|
||||
pgm.createIndex('reward_slot_holders', 'burn_block_hash', { method: 'hash' });
|
||||
pgm.createIndex('reward_slot_holders', [{ name: 'burn_block_height', sort: 'DESC' }]);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
/** @param { import("node-pg-migrate").MigrationBuilder } pgm */
|
||||
|
||||
const INDEX_METHOD = process.env.PG_IDENT_INDEX_TYPE;
|
||||
|
||||
exports.up = pgm => {
|
||||
pgm.createTable('token_offering_locked', {
|
||||
id: {
|
||||
@@ -22,5 +19,5 @@ exports.up = pgm => {
|
||||
},
|
||||
});
|
||||
|
||||
pgm.createIndex('token_offering_locked', 'address', { method: INDEX_METHOD });
|
||||
pgm.createIndex('token_offering_locked', 'address', { method: 'hash' });
|
||||
}
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
/** @param { import("node-pg-migrate").MigrationBuilder } pgm */
|
||||
|
||||
const INDEX_METHOD = process.env.PG_IDENT_INDEX_TYPE;
|
||||
|
||||
exports.up = pgm => {
|
||||
pgm.createTable('microblocks', {
|
||||
id: {
|
||||
@@ -73,8 +70,8 @@ exports.up = pgm => {
|
||||
}
|
||||
});
|
||||
|
||||
pgm.createIndex('microblocks', 'microblock_hash', { method: INDEX_METHOD });
|
||||
pgm.createIndex('microblocks', 'parent_index_block_hash', { method: INDEX_METHOD });
|
||||
pgm.createIndex('microblocks', 'microblock_hash', { method: 'hash' });
|
||||
pgm.createIndex('microblocks', 'parent_index_block_hash', { method: 'hash' });
|
||||
pgm.createIndex('microblocks', [
|
||||
{ name: 'block_height', sort: 'DESC' },
|
||||
{ name: 'microblock_sequence', sort: 'DESC' }
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
/** @param { import("node-pg-migrate").MigrationBuilder } pgm */
|
||||
|
||||
const INDEX_METHOD = process.env.PG_IDENT_INDEX_TYPE;
|
||||
|
||||
exports.up = pgm => {
|
||||
pgm.createTable('nft_metadata', {
|
||||
id: {
|
||||
@@ -43,5 +40,5 @@ exports.up = pgm => {
|
||||
}
|
||||
});
|
||||
|
||||
pgm.createIndex('nft_metadata', 'contract_id', { method: INDEX_METHOD });
|
||||
pgm.createIndex('nft_metadata', 'contract_id', { method: 'hash' });
|
||||
}
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
/** @param { import("node-pg-migrate").MigrationBuilder } pgm */
|
||||
|
||||
const INDEX_METHOD = process.env.PG_IDENT_INDEX_TYPE;
|
||||
|
||||
exports.up = pgm => {
|
||||
pgm.createTable('ft_metadata', {
|
||||
id: {
|
||||
@@ -51,5 +48,5 @@ exports.up = pgm => {
|
||||
}
|
||||
});
|
||||
|
||||
pgm.createIndex('ft_metadata', 'contract_id', { method: INDEX_METHOD });
|
||||
pgm.createIndex('ft_metadata', 'contract_id', { method: 'hash' });
|
||||
}
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
/** @param { import("node-pg-migrate").MigrationBuilder } pgm */
|
||||
|
||||
const INDEX_METHOD = process.env.PG_IDENT_INDEX_TYPE;
|
||||
|
||||
exports.up = pgm => {
|
||||
pgm.createTable('zonefiles', {
|
||||
id: {
|
||||
@@ -30,7 +27,7 @@ exports.up = pgm => {
|
||||
}
|
||||
});
|
||||
|
||||
pgm.addIndex('zonefiles', 'zonefile_hash', { method: INDEX_METHOD });
|
||||
pgm.addIndex('zonefiles', 'zonefile_hash');
|
||||
pgm.addConstraint(
|
||||
'zonefiles',
|
||||
'unique_name_zonefile_hash_tx_id_index_block_hash',
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
/** @param { import("node-pg-migrate").MigrationBuilder } pgm */
|
||||
|
||||
const INDEX_METHOD = process.env.PG_IDENT_INDEX_TYPE;
|
||||
|
||||
exports.up = pgm => {
|
||||
/**
|
||||
* Stores all `tx_id`s of transactions that affect a principal's STX balance since that cannot be
|
||||
@@ -50,8 +47,8 @@ exports.up = pgm => {
|
||||
},
|
||||
});
|
||||
|
||||
pgm.createIndex('principal_stx_txs', 'tx_id', { method: INDEX_METHOD });
|
||||
pgm.createIndex('principal_stx_txs', 'principal', { method: INDEX_METHOD });
|
||||
pgm.createIndex('principal_stx_txs', 'tx_id', { method: 'hash' });
|
||||
pgm.createIndex('principal_stx_txs', 'principal', { method: 'hash' });
|
||||
pgm.createIndex('principal_stx_txs', [
|
||||
{ name: 'block_height', sort: 'DESC' },
|
||||
{ name: 'microblock_sequence', sort: 'DESC' },
|
||||
|
||||
@@ -132,46 +132,46 @@ exports.up = pgm => {
|
||||
});
|
||||
|
||||
pgm.addConstraint('pox2_events', 'valid_event_specific_columns', `CHECK (
|
||||
CASE name
|
||||
WHEN 'handle-unlock' THEN
|
||||
first_cycle_locked IS NOT NULL AND
|
||||
CASE name
|
||||
WHEN 'handle-unlock' THEN
|
||||
first_cycle_locked IS NOT NULL AND
|
||||
first_unlocked_cycle IS NOT NULL
|
||||
WHEN 'stack-stx' THEN
|
||||
lock_period IS NOT NULL AND
|
||||
lock_amount IS NOT NULL AND
|
||||
start_burn_height IS NOT NULL AND
|
||||
lock_period IS NOT NULL AND
|
||||
lock_amount IS NOT NULL AND
|
||||
start_burn_height IS NOT NULL AND
|
||||
unlock_burn_height IS NOT NULL
|
||||
WHEN 'stack-increase' THEN
|
||||
increase_by IS NOT NULL AND
|
||||
increase_by IS NOT NULL AND
|
||||
total_locked IS NOT NULL
|
||||
WHEN 'stack-extend' THEN
|
||||
extend_count IS NOT NULL AND
|
||||
extend_count IS NOT NULL AND
|
||||
unlock_burn_height IS NOT NULL
|
||||
WHEN 'delegate-stx' THEN
|
||||
amount_ustx IS NOT NULL AND
|
||||
amount_ustx IS NOT NULL AND
|
||||
delegate_to IS NOT NULL
|
||||
WHEN 'delegate-stack-stx' THEN
|
||||
lock_period IS NOT NULL AND
|
||||
lock_amount IS NOT NULL AND
|
||||
start_burn_height IS NOT NULL AND
|
||||
unlock_burn_height IS NOT NULL AND
|
||||
lock_period IS NOT NULL AND
|
||||
lock_amount IS NOT NULL AND
|
||||
start_burn_height IS NOT NULL AND
|
||||
unlock_burn_height IS NOT NULL AND
|
||||
delegator IS NOT NULL
|
||||
WHEN 'delegate-stack-increase' THEN
|
||||
increase_by IS NOT NULL AND
|
||||
increase_by IS NOT NULL AND
|
||||
total_locked IS NOT NULL AND
|
||||
delegator IS NOT NULL
|
||||
WHEN 'delegate-stack-extend' THEN
|
||||
extend_count IS NOT NULL AND
|
||||
unlock_burn_height IS NOT NULL AND
|
||||
extend_count IS NOT NULL AND
|
||||
unlock_burn_height IS NOT NULL AND
|
||||
delegator IS NOT NULL
|
||||
WHEN 'stack-aggregation-commit' THEN
|
||||
reward_cycle IS NOT NULL AND
|
||||
reward_cycle IS NOT NULL AND
|
||||
amount_ustx IS NOT NULL
|
||||
WHEN 'stack-aggregation-commit-indexed' THEN
|
||||
reward_cycle IS NOT NULL AND
|
||||
reward_cycle IS NOT NULL AND
|
||||
amount_ustx IS NOT NULL
|
||||
WHEN 'stack-aggregation-increase' THEN
|
||||
reward_cycle IS NOT NULL AND
|
||||
reward_cycle IS NOT NULL AND
|
||||
amount_ustx IS NOT NULL
|
||||
ELSE false
|
||||
END
|
||||
|
||||
Reference in New Issue
Block a user