Use LONGBLOB and TEXT for arbitary length rows

This commit is contained in:
Erik Johnston 2015-04-10 18:45:09 +01:00
parent 7ed2ec3061
commit 4d5b098626
12 changed files with 34 additions and 34 deletions

View file

@ -32,7 +32,7 @@ CREATE TABLE IF NOT EXISTS pushers (
pushkey VARBINARY(512) NOT NULL,
ts BIGINT UNSIGNED NOT NULL,
lang VARCHAR(8),
data BLOB,
data LONGBLOB,
last_token TEXT,
last_success BIGINT UNSIGNED,
failing_since BIGINT UNSIGNED,
@ -55,7 +55,7 @@ CREATE INDEX IF NOT EXISTS push_rules_user_name on push_rules (user_name);
CREATE TABLE IF NOT EXISTS user_filters(
user_id VARCHAR(150),
filter_id BIGINT UNSIGNED,
filter_json BLOB
filter_json LONGBLOB
);
CREATE INDEX IF NOT EXISTS user_filters_by_user_id_filter_id ON user_filters(

View file

@ -22,7 +22,7 @@ CREATE TABLE IF NOT EXISTS application_services_state(
CREATE TABLE IF NOT EXISTS application_services_txns(
as_id VARCHAR(150) NOT NULL,
txn_id INTEGER NOT NULL,
event_ids BLOB NOT NULL,
event_ids LONGBLOB NOT NULL,
UNIQUE(as_id, txn_id)
);

View file

@ -16,7 +16,7 @@
CREATE TABLE IF NOT EXISTS event_content_hashes (
event_id VARCHAR(150),
algorithm VARCHAR(150),
hash BLOB,
hash LONGBLOB,
UNIQUE (event_id, algorithm)
);
@ -26,7 +26,7 @@ CREATE INDEX IF NOT EXISTS event_content_hashes_id ON event_content_hashes(event
CREATE TABLE IF NOT EXISTS event_reference_hashes (
event_id VARCHAR(150),
algorithm VARCHAR(150),
hash BLOB,
hash LONGBLOB,
UNIQUE (event_id, algorithm)
);
@ -37,7 +37,7 @@ CREATE TABLE IF NOT EXISTS event_signatures (
event_id VARCHAR(150),
signature_name VARCHAR(150),
key_id VARCHAR(150),
signature BLOB,
signature LONGBLOB,
UNIQUE (event_id, signature_name, key_id)
);
@ -48,7 +48,7 @@ CREATE TABLE IF NOT EXISTS event_edge_hashes(
event_id VARCHAR(150),
prev_event_id VARCHAR(150),
algorithm VARCHAR(150),
hash BLOB,
hash LONGBLOB,
UNIQUE (event_id, prev_event_id, algorithm)
);

View file

@ -19,8 +19,8 @@ CREATE TABLE IF NOT EXISTS events(
event_id VARCHAR(150) NOT NULL,
type VARCHAR(150) NOT NULL,
room_id VARCHAR(150) NOT NULL,
content BLOB NOT NULL,
unrecognized_keys BLOB,
content LONGBLOB NOT NULL,
unrecognized_keys LONGBLOB,
processed BOOL NOT NULL,
outlier BOOL NOT NULL,
depth BIGINT UNSIGNED DEFAULT 0 NOT NULL,
@ -35,8 +35,8 @@ CREATE INDEX IF NOT EXISTS events_room_id ON events (room_id);
CREATE TABLE IF NOT EXISTS event_json(
event_id VARCHAR(150) NOT NULL,
room_id VARCHAR(150) NOT NULL,
internal_metadata BLOB NOT NULL,
json BLOB NOT NULL,
internal_metadata LONGBLOB NOT NULL,
json LONGBLOB NOT NULL,
UNIQUE (event_id)
);
@ -93,7 +93,7 @@ CREATE TABLE IF NOT EXISTS feedback(
CREATE TABLE IF NOT EXISTS topics(
event_id VARCHAR(150) NOT NULL,
room_id VARCHAR(150) NOT NULL,
topic VARCHAR(150) NOT NULL
topic TEXT NOT NULL
);
CREATE INDEX IF NOT EXISTS topics_event_id ON topics(event_id);
@ -102,7 +102,7 @@ CREATE INDEX IF NOT EXISTS topics_room_id ON topics(room_id);
CREATE TABLE IF NOT EXISTS room_names(
event_id VARCHAR(150) NOT NULL,
room_id VARCHAR(150) NOT NULL,
name VARCHAR(150) NOT NULL
name TEXT NOT NULL
);
CREATE INDEX IF NOT EXISTS room_names_event_id ON room_names(event_id);

View file

@ -17,7 +17,7 @@ CREATE TABLE IF NOT EXISTS server_tls_certificates(
fingerprint VARCHAR(150), -- Certificate fingerprint.
from_server VARCHAR(150), -- Which key server the certificate was fetched from.
ts_added_ms BIGINT UNSIGNED, -- When the certifcate was added.
tls_certificate BLOB, -- DER encoded x509 certificate.
tls_certificate LONGBLOB, -- DER encoded x509 certificate.
UNIQUE (server_name, fingerprint)
);
@ -26,6 +26,6 @@ CREATE TABLE IF NOT EXISTS server_signature_keys(
key_id VARCHAR(150), -- Key version.
from_server VARCHAR(150), -- Which key server the key was fetched form.
ts_added_ms BIGINT UNSIGNED, -- When the key was added.
verify_key BLOB, -- NACL verification key.
verify_key LONGBLOB, -- NACL verification key.
UNIQUE (server_name, key_id)
);

View file

@ -18,7 +18,7 @@ CREATE TABLE IF NOT EXISTS received_transactions(
origin VARCHAR(150),
ts BIGINT UNSIGNED,
response_code INTEGER,
response_json BLOB,
response_json LONGBLOB,
has_been_referenced BOOL default 0, -- Whether thishas been referenced by a prev_tx
UNIQUE (transaction_id, origin)
);
@ -33,7 +33,7 @@ CREATE TABLE IF NOT EXISTS sent_transactions(
transaction_id VARCHAR(150),
destination VARCHAR(150),
response_code INTEGER DEFAULT 0,
response_json BLOB,
response_json LONGBLOB,
ts BIGINT UNSIGNED
);

View file

@ -39,7 +39,7 @@ CREATE TABLE IF NOT EXISTS application_services_state(
CREATE TABLE IF NOT EXISTS application_services_txns(
as_id VARCHAR(150) NOT NULL,
txn_id INTEGER NOT NULL,
event_ids BLOB NOT NULL,
event_ids LONGBLOB NOT NULL,
UNIQUE(as_id, txn_id)
);

View file

@ -16,7 +16,7 @@
CREATE TABLE IF NOT EXISTS event_content_hashes (
event_id VARCHAR(150),
algorithm VARCHAR(150),
hash BLOB,
hash LONGBLOB,
UNIQUE (event_id, algorithm)
);
@ -26,7 +26,7 @@ CREATE INDEX IF NOT EXISTS event_content_hashes_id ON event_content_hashes(event
CREATE TABLE IF NOT EXISTS event_reference_hashes (
event_id VARCHAR(150),
algorithm VARCHAR(150),
hash BLOB,
hash LONGBLOB,
UNIQUE (event_id, algorithm)
);
@ -37,7 +37,7 @@ CREATE TABLE IF NOT EXISTS event_signatures (
event_id VARCHAR(150),
signature_name VARCHAR(150),
key_id VARCHAR(150),
signature BLOB,
signature LONGBLOB,
UNIQUE (event_id, signature_name, key_id)
);
@ -48,7 +48,7 @@ CREATE TABLE IF NOT EXISTS event_edge_hashes(
event_id VARCHAR(150),
prev_event_id VARCHAR(150),
algorithm VARCHAR(150),
hash BLOB,
hash LONGBLOB,
UNIQUE (event_id, prev_event_id, algorithm)
);

View file

@ -19,8 +19,8 @@ CREATE TABLE IF NOT EXISTS events(
event_id VARCHAR(150) NOT NULL,
type VARCHAR(150) NOT NULL,
room_id VARCHAR(150) NOT NULL,
content BLOB NOT NULL,
unrecognized_keys BLOB,
content LONGBLOB NOT NULL,
unrecognized_keys LONGBLOB,
processed BOOL NOT NULL,
outlier BOOL NOT NULL,
depth BIGINT UNSIGNED DEFAULT 0 NOT NULL,
@ -35,8 +35,8 @@ CREATE INDEX IF NOT EXISTS events_room_id ON events (room_id);
CREATE TABLE IF NOT EXISTS event_json(
event_id VARCHAR(150) NOT NULL,
room_id VARCHAR(150) NOT NULL,
internal_metadata BLOB NOT NULL,
json BLOB NOT NULL,
internal_metadata LONGBLOB NOT NULL,
json LONGBLOB NOT NULL,
UNIQUE (event_id)
);
@ -94,7 +94,7 @@ CREATE TABLE IF NOT EXISTS feedback(
CREATE TABLE IF NOT EXISTS topics(
event_id VARCHAR(150) NOT NULL,
room_id VARCHAR(150) NOT NULL,
topic VARCHAR(150) NOT NULL,
topic TEXT NOT NULL,
UNIQUE (event_id)
);
@ -103,7 +103,7 @@ CREATE INDEX IF NOT EXISTS topics_room_id ON topics(room_id);
CREATE TABLE IF NOT EXISTS room_names(
event_id VARCHAR(150) NOT NULL,
room_id VARCHAR(150) NOT NULL,
name VARCHAR(150) NOT NULL,
name TEXT NOT NULL,
UNIQUE (event_id)
);

View file

@ -17,7 +17,7 @@ CREATE TABLE IF NOT EXISTS server_tls_certificates(
fingerprint VARCHAR(150), -- Certificate fingerprint.
from_server VARCHAR(150), -- Which key server the certificate was fetched from.
ts_added_ms BIGINT UNSIGNED, -- When the certifcate was added.
tls_certificate BLOB, -- DER encoded x509 certificate.
tls_certificate LONGBLOB, -- DER encoded x509 certificate.
UNIQUE (server_name, fingerprint)
);
@ -26,6 +26,6 @@ CREATE TABLE IF NOT EXISTS server_signature_keys(
key_id VARCHAR(150), -- Key version.
from_server VARCHAR(150), -- Which key server the key was fetched form.
ts_added_ms BIGINT UNSIGNED, -- When the key was added.
verify_key BLOB, -- NACL verification key.
verify_key LONGBLOB, -- NACL verification key.
UNIQUE (server_name, key_id)
);

View file

@ -32,7 +32,7 @@ CREATE TABLE IF NOT EXISTS pushers (
pushkey VARBINARY(512) NOT NULL,
ts BIGINT UNSIGNED NOT NULL,
lang VARCHAR(8),
data BLOB,
data LONGBLOB,
last_token TEXT,
last_success BIGINT UNSIGNED,
failing_since BIGINT UNSIGNED,
@ -55,7 +55,7 @@ CREATE INDEX IF NOT EXISTS push_rules_user_name on push_rules (user_name);
CREATE TABLE IF NOT EXISTS user_filters(
user_id VARCHAR(150),
filter_id BIGINT UNSIGNED,
filter_json BLOB
filter_json LONGBLOB
);
CREATE INDEX IF NOT EXISTS user_filters_by_user_id_filter_id ON user_filters(

View file

@ -18,7 +18,7 @@ CREATE TABLE IF NOT EXISTS received_transactions(
origin VARCHAR(150),
ts BIGINT UNSIGNED,
response_code INTEGER,
response_json BLOB,
response_json LONGBLOB,
has_been_referenced BOOL default 0, -- Whether thishas been referenced by a prev_tx
UNIQUE (transaction_id, origin)
);
@ -33,7 +33,7 @@ CREATE TABLE IF NOT EXISTS sent_transactions(
transaction_id VARCHAR(150),
destination VARCHAR(150),
response_code INTEGER DEFAULT 0,
response_json BLOB,
response_json LONGBLOB,
ts BIGINT UNSIGNED
);