Skip to content

Commit

Permalink
Update storage.sql script (#2023)
Browse files Browse the repository at this point in the history
Update the storage.sql setup script to match the script in trillian
1.6.0[1]. This prevents the following error when running the script against
the most revent MySQL version in GCP:

   You have an error in your SQL syntax; check the manual that
   corresponds to your MySQL server version for the right syntax to use
   near 'IF NOT EXISTS TreeHeadRevisionIdx ON TreeHead(TreeId,
   TreeRevision)' at line 1

[1] https://github.com/google/trillian/blob/v1.6.0/storage/mysql/schema/storage.sql

Signed-off-by: Colleen Murphy <[email protected]>
  • Loading branch information
cmurphy authored Feb 27, 2024
1 parent 56cb881 commit cb8a9b4
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions scripts/storage.sql
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ CREATE TABLE IF NOT EXISTS Trees(
CreateTimeMillis BIGINT NOT NULL,
UpdateTimeMillis BIGINT NOT NULL,
MaxRootDurationMillis BIGINT NOT NULL,
PrivateKey MEDIUMBLOB NOT NULL,
PublicKey MEDIUMBLOB NOT NULL,
PrivateKey MEDIUMBLOB NOT NULL, -- Unused.
PublicKey MEDIUMBLOB NOT NULL, -- This is now used to store settings.
Deleted BOOLEAN,
DeleteTimeMillis BIGINT,
PRIMARY KEY(TreeId)
Expand Down Expand Up @@ -75,7 +75,7 @@ CREATE TABLE IF NOT EXISTS TreeHead(
FOREIGN KEY(TreeId) REFERENCES Trees(TreeId) ON DELETE CASCADE
);

CREATE UNIQUE INDEX IF NOT EXISTS TreeHeadRevisionIdx
CREATE UNIQUE INDEX TreeHeadRevisionIdx
ON TreeHead(TreeId, TreeRevision);

-- ---------------------------------------------
Expand Down Expand Up @@ -128,8 +128,7 @@ CREATE TABLE IF NOT EXISTS SequencedLeafData(
FOREIGN KEY(TreeId, LeafIdentityHash) REFERENCES LeafData(TreeId, LeafIdentityHash) ON DELETE CASCADE
);


CREATE INDEX IF NOT EXISTS SequencedLeafMerkleIdx
CREATE INDEX SequencedLeafMerkleIdx
ON SequencedLeafData(TreeId, MerkleLeafHash);

CREATE TABLE IF NOT EXISTS Unsequenced(
Expand Down

0 comments on commit cb8a9b4

Please sign in to comment.