Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions schema/migration-3-0004-20200810.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
CREATE FUNCTION migrate() RETURNS void AS $$
DECLARE
next_version int ;
BEGIN
SELECT stage_three + 1 INTO next_version FROM schema_version ;
IF next_version <= 4 THEN
-- -------------------------------------------------------------------------
-- More hand crafted indices for performance

-- helpful in case anyone is looking for a utxo by a payment credential.

CREATE INDEX idx_tx_out_payment_cred
ON tx_out(payment_cred);

CREATE INDEX idx_pool_update_hash_id
ON pool_update(hash_id);

-- -------------------------------------------------------------------------

UPDATE schema_version SET stage_three = 4 ;
RAISE NOTICE 'DB has been migrated to stage_three version %', next_version ;
END IF ;
END ;
$$ LANGUAGE plpgsql ;

SELECT migrate() ;

DROP FUNCTION migrate() ;