mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
ee85d948e2
GitOrigin-RevId: ef2ef77e26df59d1af3df6dc664e284d3c70102d
16 lines
607 B
SQL
16 lines
607 B
SQL
CREATE TABLE global_blobs (
|
|
hash_bytes bytea NOT NULL,
|
|
byte_length integer NOT NULL,
|
|
string_length integer,
|
|
global boolean,
|
|
CONSTRAINT global_blobs_pkey PRIMARY KEY (hash_bytes),
|
|
CONSTRAINT global_blobs_byte_length_non_negative
|
|
CHECK (byte_length >= 0),
|
|
CONSTRAINT global_blobs_string_length_non_negative
|
|
CHECK (string_length IS NULL OR string_length >= 0)
|
|
);
|
|
|
|
INSERT INTO global_blobs (hash_bytes, byte_length, string_length, global)
|
|
SELECT hash_bytes, byte_length, string_length, true
|
|
FROM blobs
|
|
WHERE hash_bytes IN (SELECT hash_bytes FROM global_blob_hashes);
|