Skip to content

Commit

Permalink
Merge pull request hyperledger-archives#182 from Cargill/pschwarz-sta…
Browse files Browse the repository at this point in the history
…te-merkle-sql-collapse-migrations

Consolidate migrations into single migration
  • Loading branch information
peterschwarz authored Sep 9, 2021
2 parents c5e3cd9 + fbf5847 commit 6f19f76
Show file tree
Hide file tree
Showing 14 changed files with 57 additions and 341 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
-- limitations under the License.
-- -----------------------------------------------------------------------------

DROP TABLE IF EXISTS merkle_radix_state_root_leaf_index;
DROP TABLE IF EXISTS merkle_radix_state_root;
DROP TABLE IF EXISTS merkle_radix_change_log_addition;
DROP TABLE IF EXISTS merkle_radix_change_log_deletion;
DROP TABLE IF EXISTS merkle_radix_tree_node;
DROP TABLE IF EXISTS merkle_radix_leaf;
DROP TABLE IF EXISTS merkle_radix_tree;
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,32 @@
-- limitations under the License.
-- -----------------------------------------------------------------------------

CREATE TABLE IF NOT EXISTS merkle_radix_tree (
id BIGSERIAL PRIMARY KEY,
name VARCHAR(512),
UNIQUE(name)
);

INSERT INTO merkle_radix_tree (name) VALUES ('default');

CREATE TABLE IF NOT EXISTS merkle_radix_leaf (
id BIGSERIAL PRIMARY KEY,
tree_id BIGINT NOT NULL,
address VARCHAR(70) NOT NULL,
data BYTEA,
FOREIGN KEY(tree_id) REFERENCES merkle_radix_tree (id)
);

CREATE TABLE IF NOT EXISTS merkle_radix_tree_node (
hash VARCHAR(64) NOT NULL,
tree_id BIGINT NOT NULL,
leaf_id BIGINT,
children VARCHAR(64)[],
PRIMARY KEY (hash, tree_id),
FOREIGN KEY(tree_id) REFERENCES merkle_radix_tree(id),
FOREIGN KEY(leaf_id) REFERENCES merkle_radix_leaf(id)
);

create TABLE IF NOT EXISTS merkle_radix_change_log_addition (
id BIGSERIAL PRIMARY KEY,
tree_id BIGINT NOT NULL,
Expand Down

This file was deleted.

This file was deleted.

Empty file.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@

DROP TABLE IF EXISTS merkle_radix_change_log_addition;
DROP TABLE IF EXISTS merkle_radix_change_log_deletion;
DROP TABLE IF EXISTS merkle_radix_tree_node;
DROP TABLE IF EXISTS merkle_radix_leaf;
DROP TABLE IF EXISTS merkle_radix_tree;
Loading

0 comments on commit 6f19f76

Please sign in to comment.