-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add - table mapping tx hashes to bodies.
it would make sense for this just to sit in the tx table, but see doc/plugin-system.md also note that I used a hand written migration file. see comment in the file about being unable to get the migration tool to run. :(
- Loading branch information
Matthew Eric Bassett
committed
Jul 8, 2020
1 parent
362b09e
commit b1302e0
Showing
3 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
-- Hand written migration because I cann't get the schema migration tool to work. | ||
-- see doc/schema-management.md for context. | ||
-- `cabal run cardano-db-sync-db-tool -- create-migration --mdir schema/` does not work. | ||
-- I've tried running it from within nix-shell. I get the following: | ||
-- | ||
-- | ||
-- cabal: Could not resolve dependencies: | ||
-- [__0] trying: cardano-binary-test-1.3.0 (user goal) | ||
-- [__1] unknown package: quickcheck-instances (dependency of | ||
-- cardano-binary-test) | ||
-- [__1] fail (backjumping, conflict set: cardano-binary-test, | ||
-- quickcheck-instances) | ||
-- After searching the rest of the dependency tree exhaustively, these were the | ||
-- goals I've had most trouble fulfilling: cardano-binary-test, | ||
-- quickcheck-instances | ||
|
||
CREATE FUNCTION migrate() RETURNS void AS $$ | ||
|
||
BEGIN | ||
EXECUTE 'create table tx_body (id serial8 primary key unique, | ||
hash hash32type not null, | ||
body bytea not null)'; | ||
EXECUTE 'CREATE INDEX idx_tx_body_hash ON tx_body(hash);'; | ||
EXECUTE 'ALTER TABLE "tx_body" ADD CONSTRAINT "unique_tx_body" UNIQUE("hash")' ; | ||
END; | ||
|
||
$$ LANGUAGE plpgsql; | ||
|
||
SELECT migrate(); | ||
|
||
DROP FUNCTION migrate(); |