Skip to content

Commit

Permalink
Change PK and add index order
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalkuo committed Sep 21, 2018
1 parent 39e36d6 commit c27e1d5
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions storage/postgres/storage.sql
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,11 @@ CREATE TABLE IF NOT EXISTS tree_head(
root_hash BYTEA NOT NULL,
root_signature BYTEA NOT NULL,
tree_revision BIGINT,
PRIMARY KEY(tree_id, tree_head_timestamp),
PRIMARY KEY(tree_id, tree_revision),
FOREIGN KEY(tree_id) REFERENCES trees(tree_id) ON DELETE CASCADE
);

CREATE UNIQUE INDEX TreeHeadRevisionIdx
ON tree_head(tree_id, tree_revision);
CREATE UNIQUE INDEX TreeHeadRevisionIdx ON tree_head(tree_id, tree_revision DESC);

-- ---------------------------------------------
-- Log specific stuff here
Expand Down

0 comments on commit c27e1d5

Please sign in to comment.