-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
185 additions
and
178 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,45 @@ | ||
CREATE TABLE batches ( | ||
userid STRING(MAX) NOT NULL, | ||
collection INT64 NOT NULL, | ||
id TIMESTAMP NOT NULL, | ||
fxa_kid STRING(MAX) NOT NULL, | ||
bsos STRING(MAX) NOT NULL, | ||
expiry TIMESTAMP NOT NULL, | ||
timestamp TIMESTAMP, | ||
) PRIMARY KEY(userid, fxa_kid, collection, id); | ||
|
||
CREATE TABLE collections ( | ||
collectionid INT64 NOT NULL, | ||
name STRING(MAX) NOT NULL, | ||
) PRIMARY KEY(collectionid); | ||
|
||
CREATE TABLE user_collections ( | ||
userid STRING(MAX) NOT NULL, | ||
fxa_kid STRING(MAX) NOT NULL, | ||
collection INT64 NOT NULL, | ||
last_modified TIMESTAMP NOT NULL, | ||
) PRIMARY KEY(userid, fxa_kid, collection); | ||
fxa_uid STRING(MAX) NOT NULL, | ||
fxa_kid STRING(MAX) NOT NULL, | ||
collection_id INT64 NOT NULL, | ||
modified TIMESTAMP NOT NULL, | ||
) PRIMARY KEY(fxa_uid, fxa_kid, collection_id); | ||
|
||
|
||
CREATE TABLE bso ( | ||
userid STRING(MAX) NOT NULL, | ||
fxa_kid STRING(MAX) NOT NULL, | ||
collection INT64 NOT NULL, | ||
id STRING(MAX) NOT NULL, | ||
fxa_uid STRING(MAX) NOT NULL, | ||
fxa_kid STRING(MAX) NOT NULL, | ||
collection_id INT64 NOT NULL, | ||
id STRING(MAX) NOT NULL, | ||
|
||
sortindex INT64, | ||
modified TIMESTAMP NOT NULL, | ||
payload STRING(MAX) NOT NULL, | ||
ttl TIMESTAMP NOT NULL, | ||
) PRIMARY KEY(userid, fxa_kid, collection, id), | ||
|
||
payload STRING(MAX) NOT NULL, | ||
|
||
modified TIMESTAMP NOT NULL, | ||
expiry TIMESTAMP NOT NULL, | ||
) PRIMARY KEY(fxa_uid, fxa_kid, collection_id, id), | ||
INTERLEAVE IN PARENT user_collections ON DELETE CASCADE; | ||
|
||
CREATE INDEX BsoLastModified ON bso(userid, fxa_kid, collection, modified DESC, ttl), INTERLEAVE IN user_collections; | ||
CREATE INDEX BsoLastModified | ||
ON bso(fxa_uid, fxa_kid, collection_id, modified DESC, expiry), | ||
INTERLEAVE IN user_collections; | ||
|
||
CREATE INDEX BsoExpiry ON bso(expiry); | ||
|
||
|
||
CREATE TABLE collections ( | ||
id INT64 NOT NULL, | ||
name STRING(MAX) NOT NULL, | ||
) PRIMARY KEY(id); | ||
|
||
|
||
CREATE INDEX BsoTtl ON bso(ttl) | ||
CREATE TABLE batches ( | ||
fxa_uid STRING(MAX) NOT NULL, | ||
fxa_kid STRING(MAX) NOT NULL, | ||
id TIMESTAMP NOT NULL, | ||
collection_id INT64 NOT NULL, | ||
bsos STRING(MAX) NOT NULL, | ||
expiry TIMESTAMP NOT NULL, | ||
timestamp TIMESTAMP, | ||
) PRIMARY KEY(fxa_uid, fxa_kid, collection_id, id); |
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
Oops, something went wrong.