summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-04-10 18:45:09 +0100
committerErik Johnston <erik@matrix.org>2015-04-10 18:45:09 +0100
commit4d5b0986261db7e9a4389c6fe2eb4808e5946e91 (patch)
tree355349308e5e3580341e57a2d74f032ffe97968a /synapse/storage
parentHandle the fact that in sqlite binary data might be stored as unicode or bytes (diff)
downloadsynapse-4d5b0986261db7e9a4389c6fe2eb4808e5946e91.tar.xz
Use LONGBLOB and TEXT for arbitary length rows
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/schema/delta/12/v12.sql4
-rw-r--r--synapse/storage/schema/delta/15/appservice_txns.sql2
-rw-r--r--synapse/storage/schema/full_schemas/11/event_signatures.sql8
-rw-r--r--synapse/storage/schema/full_schemas/11/im.sql12
-rw-r--r--synapse/storage/schema/full_schemas/11/keys.sql4
-rw-r--r--synapse/storage/schema/full_schemas/11/transactions.sql4
-rw-r--r--synapse/storage/schema/full_schemas/16/application_services.sql2
-rw-r--r--synapse/storage/schema/full_schemas/16/event_signatures.sql8
-rw-r--r--synapse/storage/schema/full_schemas/16/im.sql12
-rw-r--r--synapse/storage/schema/full_schemas/16/keys.sql4
-rw-r--r--synapse/storage/schema/full_schemas/16/push.sql4
-rw-r--r--synapse/storage/schema/full_schemas/16/transactions.sql4
12 files changed, 34 insertions, 34 deletions
diff --git a/synapse/storage/schema/delta/12/v12.sql b/synapse/storage/schema/delta/12/v12.sql
index 1247fd175c..a246943f5a 100644
--- a/synapse/storage/schema/delta/12/v12.sql
+++ b/synapse/storage/schema/delta/12/v12.sql
@@ -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(
diff --git a/synapse/storage/schema/delta/15/appservice_txns.sql b/synapse/storage/schema/delta/15/appservice_txns.sql
index 2f4c3eae5f..ddea8fc693 100644
--- a/synapse/storage/schema/delta/15/appservice_txns.sql
+++ b/synapse/storage/schema/delta/15/appservice_txns.sql
@@ -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)
 );
 
diff --git a/synapse/storage/schema/full_schemas/11/event_signatures.sql b/synapse/storage/schema/full_schemas/11/event_signatures.sql
index 0c27bc1f34..09886f607c 100644
--- a/synapse/storage/schema/full_schemas/11/event_signatures.sql
+++ b/synapse/storage/schema/full_schemas/11/event_signatures.sql
@@ -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)
 );
 
diff --git a/synapse/storage/schema/full_schemas/11/im.sql b/synapse/storage/schema/full_schemas/11/im.sql
index e75093a446..9c47f51742 100644
--- a/synapse/storage/schema/full_schemas/11/im.sql
+++ b/synapse/storage/schema/full_schemas/11/im.sql
@@ -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);
diff --git a/synapse/storage/schema/full_schemas/11/keys.sql b/synapse/storage/schema/full_schemas/11/keys.sql
index 551650cf1d..35f141c288 100644
--- a/synapse/storage/schema/full_schemas/11/keys.sql
+++ b/synapse/storage/schema/full_schemas/11/keys.sql
@@ -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)
 );
diff --git a/synapse/storage/schema/full_schemas/11/transactions.sql b/synapse/storage/schema/full_schemas/11/transactions.sql
index 67c79db3e0..c2fab10aa0 100644
--- a/synapse/storage/schema/full_schemas/11/transactions.sql
+++ b/synapse/storage/schema/full_schemas/11/transactions.sql
@@ -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
 );
 
diff --git a/synapse/storage/schema/full_schemas/16/application_services.sql b/synapse/storage/schema/full_schemas/16/application_services.sql
index fbc3e08a1c..bc709df92d 100644
--- a/synapse/storage/schema/full_schemas/16/application_services.sql
+++ b/synapse/storage/schema/full_schemas/16/application_services.sql
@@ -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)
 );
 
diff --git a/synapse/storage/schema/full_schemas/16/event_signatures.sql b/synapse/storage/schema/full_schemas/16/event_signatures.sql
index 0c27bc1f34..09886f607c 100644
--- a/synapse/storage/schema/full_schemas/16/event_signatures.sql
+++ b/synapse/storage/schema/full_schemas/16/event_signatures.sql
@@ -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)
 );
 
diff --git a/synapse/storage/schema/full_schemas/16/im.sql b/synapse/storage/schema/full_schemas/16/im.sql
index 81dae2a911..19f0f34143 100644
--- a/synapse/storage/schema/full_schemas/16/im.sql
+++ b/synapse/storage/schema/full_schemas/16/im.sql
@@ -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)
 );
 
diff --git a/synapse/storage/schema/full_schemas/16/keys.sql b/synapse/storage/schema/full_schemas/16/keys.sql
index 551650cf1d..35f141c288 100644
--- a/synapse/storage/schema/full_schemas/16/keys.sql
+++ b/synapse/storage/schema/full_schemas/16/keys.sql
@@ -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)
 );
diff --git a/synapse/storage/schema/full_schemas/16/push.sql b/synapse/storage/schema/full_schemas/16/push.sql
index 99175b9632..33300736f9 100644
--- a/synapse/storage/schema/full_schemas/16/push.sql
+++ b/synapse/storage/schema/full_schemas/16/push.sql
@@ -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(
diff --git a/synapse/storage/schema/full_schemas/16/transactions.sql b/synapse/storage/schema/full_schemas/16/transactions.sql
index e48eb44144..f381e67603 100644
--- a/synapse/storage/schema/full_schemas/16/transactions.sql
+++ b/synapse/storage/schema/full_schemas/16/transactions.sql
@@ -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
 );