Skip to content

Commit

Permalink
Consolidate migrations into single migration
Browse files Browse the repository at this point in the history
This change consolidates the migrations to remove the complexity of
adding new tables and migrating data.

Signed-off-by: Peter Schwarz <[email protected]>
  • Loading branch information
peterschwarz committed Sep 8, 2021
1 parent 676488d commit fbf5847
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 fbf5847

Please sign in to comment.