diff --git a/synapse/storage/schema/delta/12/v12.sql b/synapse/storage/schema/delta/12/v12.sql
index a246943f5a68c78e947e3ab73e3413bfed535b7e..878c36260ac0022be8ba2d98b938c4cbce5cc883 100644
--- a/synapse/storage/schema/delta/12/v12.sql
+++ b/synapse/storage/schema/delta/12/v12.sql
@@ -14,16 +14,16 @@
  */
 
 CREATE TABLE IF NOT EXISTS rejections(
-    event_id VARCHAR(150) NOT NULL,
-    reason VARCHAR(150) NOT NULL,
-    last_check VARCHAR(150) NOT NULL,
+    event_id TEXT NOT NULL,
+    reason TEXT NOT NULL,
+    last_check TEXT NOT NULL,
     UNIQUE (event_id)
 );
 
 -- Push notification endpoints that users have configured
 CREATE TABLE IF NOT EXISTS pushers (
   id INTEGER PRIMARY KEY AUTOINCREMENT,
-  user_name VARCHAR(150) NOT NULL,
+  user_name TEXT NOT NULL,
   profile_tag VARCHAR(32) NOT NULL,
   kind VARCHAR(8) NOT NULL,
   app_id VARCHAR(64) NOT NULL,
@@ -41,19 +41,19 @@ CREATE TABLE IF NOT EXISTS pushers (
 
 CREATE TABLE IF NOT EXISTS push_rules (
   id INTEGER PRIMARY KEY AUTOINCREMENT,
-  user_name VARCHAR(150) NOT NULL,
-  rule_id VARCHAR(150) NOT NULL,
+  user_name TEXT NOT NULL,
+  rule_id TEXT NOT NULL,
   priority_class TINYINT NOT NULL,
   priority INTEGER NOT NULL DEFAULT 0,
-  conditions VARCHAR(150) NOT NULL,
-  actions VARCHAR(150) NOT NULL,
+  conditions TEXT NOT NULL,
+  actions TEXT NOT NULL,
   UNIQUE(user_name, rule_id)
 );
 
 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),
+  user_id TEXT,
   filter_id BIGINT UNSIGNED,
   filter_json LONGBLOB
 );
diff --git a/synapse/storage/schema/delta/13/v13.sql b/synapse/storage/schema/delta/13/v13.sql
index d1da2b48e2e225da99f23032518649a0dc64cc89..32659240130da81d1cb9baadbc116a548b279ba5 100644
--- a/synapse/storage/schema/delta/13/v13.sql
+++ b/synapse/storage/schema/delta/13/v13.sql
@@ -15,10 +15,10 @@
 
 CREATE TABLE IF NOT EXISTS application_services(
     id INTEGER PRIMARY KEY AUTOINCREMENT,
-    url VARCHAR(150),
-    token VARCHAR(150),
-    hs_token VARCHAR(150),
-    sender VARCHAR(150),
+    url TEXT,
+    token TEXT,
+    hs_token TEXT,
+    sender TEXT,
     UNIQUE(token)
 );
 
@@ -26,6 +26,6 @@ CREATE TABLE IF NOT EXISTS application_services_regex(
     id INTEGER PRIMARY KEY AUTOINCREMENT,
     as_id BIGINT UNSIGNED NOT NULL,
     namespace INTEGER,  /* enum[room_id|room_alias|user_id] */
-    regex VARCHAR(150),
+    regex TEXT,
     FOREIGN KEY(as_id) REFERENCES application_services(id)
 );
diff --git a/synapse/storage/schema/delta/14/v14.sql b/synapse/storage/schema/delta/14/v14.sql
index e5fedc585137376ec5bf77b92ebf9570e7ca1bc7..1d09ad7a15e76f4258553b0e8ad4db452b3dff25 100644
--- a/synapse/storage/schema/delta/14/v14.sql
+++ b/synapse/storage/schema/delta/14/v14.sql
@@ -14,8 +14,8 @@
  */
 CREATE TABLE IF NOT EXISTS push_rules_enable (
   id INTEGER PRIMARY KEY AUTOINCREMENT,
-  user_name VARCHAR(150) NOT NULL,
-  rule_id VARCHAR(150) NOT NULL,
+  user_name TEXT NOT NULL,
+  rule_id TEXT NOT NULL,
   enabled TINYINT,
   UNIQUE(user_name, rule_id)
 );
diff --git a/synapse/storage/schema/delta/15/appservice_txns.sql b/synapse/storage/schema/delta/15/appservice_txns.sql
index 1c3324f4158838630a5fc84535f02afea971c4f9..db2e7203935f4c82b3b1ad65efd94aba2e80184c 100644
--- a/synapse/storage/schema/delta/15/appservice_txns.sql
+++ b/synapse/storage/schema/delta/15/appservice_txns.sql
@@ -14,13 +14,13 @@
  */
 
 CREATE TABLE IF NOT EXISTS application_services_state(
-    as_id VARCHAR(150) PRIMARY KEY,
+    as_id TEXT PRIMARY KEY,
     state VARCHAR(5),
     last_txn INTEGER
 );
 
 CREATE TABLE IF NOT EXISTS application_services_txns(
-    as_id VARCHAR(150) NOT NULL,
+    as_id TEXT NOT NULL,
     txn_id INTEGER NOT NULL,
     event_ids TEXT NOT NULL,
     UNIQUE(as_id, txn_id)
diff --git a/synapse/storage/schema/delta/16/users.sql b/synapse/storage/schema/delta/16/users.sql
index db27bdca02388bb2df62f85067ab2806ded5bb2f..cd0709250d846c64bfe4a9aa5f509297a3cff528 100644
--- a/synapse/storage/schema/delta/16/users.sql
+++ b/synapse/storage/schema/delta/16/users.sql
@@ -2,9 +2,9 @@
 -- MUST BE DONE BEFORE REMOVING ID COLUMN FROM USERS TABLE BELOW
 CREATE TABLE IF NOT EXISTS new_access_tokens(
     id BIGINT UNSIGNED PRIMARY KEY,
-    user_id VARCHAR(150) NOT NULL,
-    device_id VARCHAR(150),
-    token VARCHAR(150) NOT NULL,
+    user_id TEXT NOT NULL,
+    device_id TEXT,
+    token TEXT NOT NULL,
     last_used BIGINT UNSIGNED,
     UNIQUE(token)
 );
@@ -20,8 +20,8 @@ ALTER TABLE new_access_tokens RENAME TO access_tokens;
 
 -- Remove ID column from `users` table
 CREATE TABLE IF NOT EXISTS new_users(
-    name VARCHAR(150),
-    password_hash VARCHAR(150),
+    name TEXT,
+    password_hash TEXT,
     creation_ts BIGINT UNSIGNED,
     admin BOOL DEFAULT 0 NOT NULL,
     UNIQUE(name)
@@ -36,11 +36,11 @@ ALTER TABLE new_users RENAME TO users;
 
 -- Remove UNIQUE constraint from `user_ips` table
 CREATE TABLE IF NOT EXISTS new_user_ips (
-    user_id VARCHAR(150) NOT NULL,
-    access_token VARCHAR(150) NOT NULL,
-    device_id VARCHAR(150),
-    ip VARCHAR(150) NOT NULL,
-    user_agent VARCHAR(150) NOT NULL,
+    user_id TEXT NOT NULL,
+    access_token TEXT NOT NULL,
+    device_id TEXT,
+    ip TEXT NOT NULL,
+    user_agent TEXT NOT NULL,
     last_seen BIGINT UNSIGNED NOT NULL
 );
 
diff --git a/synapse/storage/schema/full_schemas/11/event_edges.sql b/synapse/storage/schema/full_schemas/11/event_edges.sql
index 05d0874f0d309acffd232dc619df259099642105..f7020f779379a75aa285247b53e70ae53a9f0a4b 100644
--- a/synapse/storage/schema/full_schemas/11/event_edges.sql
+++ b/synapse/storage/schema/full_schemas/11/event_edges.sql
@@ -14,8 +14,8 @@
  */
 
 CREATE TABLE IF NOT EXISTS event_forward_extremities(
-    event_id VARCHAR(150) NOT NULL,
-    room_id VARCHAR(150) NOT NULL,
+    event_id TEXT NOT NULL,
+    room_id TEXT NOT NULL,
     UNIQUE (event_id, room_id)
 );
 
@@ -24,8 +24,8 @@ CREATE INDEX ev_extrem_id ON event_forward_extremities(event_id);
 
 
 CREATE TABLE IF NOT EXISTS event_backward_extremities(
-    event_id VARCHAR(150) NOT NULL,
-    room_id VARCHAR(150) NOT NULL,
+    event_id TEXT NOT NULL,
+    room_id TEXT NOT NULL,
     UNIQUE (event_id, room_id)
 );
 
@@ -34,9 +34,9 @@ CREATE INDEX ev_b_extrem_id ON event_backward_extremities(event_id);
 
 
 CREATE TABLE IF NOT EXISTS event_edges(
-    event_id VARCHAR(150) NOT NULL,
-    prev_event_id VARCHAR(150) NOT NULL,
-    room_id VARCHAR(150) NOT NULL,
+    event_id TEXT NOT NULL,
+    prev_event_id TEXT NOT NULL,
+    room_id TEXT NOT NULL,
     is_state BOOL NOT NULL,
     UNIQUE (event_id, prev_event_id, room_id, is_state)
 );
@@ -46,7 +46,7 @@ CREATE INDEX ev_edges_prev_id ON event_edges(prev_event_id);
 
 
 CREATE TABLE IF NOT EXISTS room_depth(
-    room_id VARCHAR(150) NOT NULL,
+    room_id TEXT NOT NULL,
     min_depth INTEGER NOT NULL,
     UNIQUE (room_id)
 );
@@ -55,8 +55,8 @@ CREATE INDEX room_depth_room ON room_depth(room_id);
 
 
 create TABLE IF NOT EXISTS event_destinations(
-    event_id VARCHAR(150) NOT NULL,
-    destination VARCHAR(150) NOT NULL,
+    event_id TEXT NOT NULL,
+    destination TEXT NOT NULL,
     delivered_ts BIGINT DEFAULT 0, -- or 0 if not delivered
     UNIQUE (event_id, destination)
 );
@@ -65,10 +65,10 @@ CREATE INDEX event_destinations_id ON event_destinations(event_id);
 
 
 CREATE TABLE IF NOT EXISTS state_forward_extremities(
-    event_id VARCHAR(150) NOT NULL,
-    room_id VARCHAR(150) NOT NULL,
-    type VARCHAR(150) NOT NULL,
-    state_key VARCHAR(150) NOT NULL,
+    event_id TEXT NOT NULL,
+    room_id TEXT NOT NULL,
+    type TEXT NOT NULL,
+    state_key TEXT NOT NULL,
     UNIQUE (event_id, room_id)
 );
 
@@ -79,9 +79,9 @@ CREATE INDEX st_extrem_id ON state_forward_extremities(event_id);
 
 
 CREATE TABLE IF NOT EXISTS event_auth(
-    event_id VARCHAR(150) NOT NULL,
-    auth_id VARCHAR(150) NOT NULL,
-    room_id VARCHAR(150) NOT NULL,
+    event_id TEXT NOT NULL,
+    auth_id TEXT NOT NULL,
+    room_id TEXT NOT NULL,
     UNIQUE (event_id, auth_id, room_id)
 );
 
diff --git a/synapse/storage/schema/full_schemas/11/event_signatures.sql b/synapse/storage/schema/full_schemas/11/event_signatures.sql
index 429182736814da22fbb2cde78118a64f658a0238..636b2d3353a435334ccc6472743ddd8b0590c3c0 100644
--- a/synapse/storage/schema/full_schemas/11/event_signatures.sql
+++ b/synapse/storage/schema/full_schemas/11/event_signatures.sql
@@ -14,8 +14,8 @@
  */
 
 CREATE TABLE IF NOT EXISTS event_content_hashes (
-    event_id VARCHAR(150),
-    algorithm VARCHAR(150),
+    event_id TEXT,
+    algorithm TEXT,
     hash bytea,
     UNIQUE (event_id, algorithm)
 );
@@ -24,8 +24,8 @@ CREATE INDEX event_content_hashes_id ON event_content_hashes(event_id);
 
 
 CREATE TABLE IF NOT EXISTS event_reference_hashes (
-    event_id VARCHAR(150),
-    algorithm VARCHAR(150),
+    event_id TEXT,
+    algorithm TEXT,
     hash bytea,
     UNIQUE (event_id, algorithm)
 );
@@ -34,9 +34,9 @@ CREATE INDEX event_reference_hashes_id ON event_reference_hashes(event_id);
 
 
 CREATE TABLE IF NOT EXISTS event_signatures (
-    event_id VARCHAR(150),
-    signature_name VARCHAR(150),
-    key_id VARCHAR(150),
+    event_id TEXT,
+    signature_name TEXT,
+    key_id TEXT,
     signature bytea,
     UNIQUE (event_id, signature_name, key_id)
 );
@@ -45,9 +45,9 @@ CREATE INDEX event_signatures_id ON event_signatures(event_id);
 
 
 CREATE TABLE IF NOT EXISTS event_edge_hashes(
-    event_id VARCHAR(150),
-    prev_event_id VARCHAR(150),
-    algorithm VARCHAR(150),
+    event_id TEXT,
+    prev_event_id TEXT,
+    algorithm TEXT,
     hash bytea,
     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 addbec588584e691d8fdfb26b772e7a1af1ee4eb..1901654ac2be561ad043ce0afdafc54ded9ec867 100644
--- a/synapse/storage/schema/full_schemas/11/im.sql
+++ b/synapse/storage/schema/full_schemas/11/im.sql
@@ -16,9 +16,9 @@
 CREATE TABLE IF NOT EXISTS events(
     stream_ordering INTEGER PRIMARY KEY AUTOINCREMENT,
     topological_ordering BIGINT NOT NULL,
-    event_id VARCHAR(150) NOT NULL,
-    type VARCHAR(150) NOT NULL,
-    room_id VARCHAR(150) NOT NULL,
+    event_id TEXT NOT NULL,
+    type TEXT NOT NULL,
+    room_id TEXT NOT NULL,
     content TEXT NOT NULL,
     unrecognized_keys TEXT,
     processed BOOL NOT NULL,
@@ -33,8 +33,8 @@ CREATE INDEX 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,
+    event_id TEXT NOT NULL,
+    room_id TEXT NOT NULL,
     internal_metadata TEXT NOT NULL,
     json TEXT NOT NULL,
     UNIQUE (event_id)
@@ -44,11 +44,11 @@ CREATE INDEX event_json_room_id ON event_json(room_id);
 
 
 CREATE TABLE IF NOT EXISTS state_events(
-    event_id VARCHAR(150) NOT NULL,
-    room_id VARCHAR(150) NOT NULL,
-    type VARCHAR(150) NOT NULL,
-    state_key VARCHAR(150) NOT NULL,
-    prev_state VARCHAR(150),
+    event_id TEXT NOT NULL,
+    room_id TEXT NOT NULL,
+    type TEXT NOT NULL,
+    state_key TEXT NOT NULL,
+    prev_state TEXT,
     UNIQUE (event_id)
 );
 
@@ -58,10 +58,10 @@ CREATE INDEX state_events_state_key ON state_events (state_key);
 
 
 CREATE TABLE IF NOT EXISTS current_state_events(
-    event_id VARCHAR(150) NOT NULL,
-    room_id VARCHAR(150) NOT NULL,
-    type VARCHAR(150) NOT NULL,
-    state_key VARCHAR(150) NOT NULL,
+    event_id TEXT NOT NULL,
+    room_id TEXT NOT NULL,
+    type TEXT NOT NULL,
+    state_key TEXT NOT NULL,
     UNIQUE (room_id, type, state_key)
 );
 
@@ -71,11 +71,11 @@ CREATE INDEX current_state_events_type ON current_state_events (type);
 CREATE INDEX current_state_events_state_key ON current_state_events (state_key);
 
 CREATE TABLE IF NOT EXISTS room_memberships(
-    event_id VARCHAR(150) NOT NULL,
-    user_id VARCHAR(150) NOT NULL,
-    sender VARCHAR(150) NOT NULL,
-    room_id VARCHAR(150) NOT NULL,
-    membership VARCHAR(150) NOT NULL
+    event_id TEXT NOT NULL,
+    user_id TEXT NOT NULL,
+    sender TEXT NOT NULL,
+    room_id TEXT NOT NULL,
+    membership TEXT NOT NULL
 );
 
 CREATE INDEX room_memberships_event_id ON room_memberships (event_id);
@@ -83,16 +83,16 @@ CREATE INDEX room_memberships_room_id ON room_memberships (room_id);
 CREATE INDEX room_memberships_user_id ON room_memberships (user_id);
 
 CREATE TABLE IF NOT EXISTS feedback(
-    event_id VARCHAR(150) NOT NULL,
-    feedback_type VARCHAR(150),
-    target_event_id VARCHAR(150),
-    sender VARCHAR(150),
-    room_id VARCHAR(150)
+    event_id TEXT NOT NULL,
+    feedback_type TEXT,
+    target_event_id TEXT,
+    sender TEXT,
+    room_id TEXT
 );
 
 CREATE TABLE IF NOT EXISTS topics(
-    event_id VARCHAR(150) NOT NULL,
-    room_id VARCHAR(150) NOT NULL,
+    event_id TEXT NOT NULL,
+    room_id TEXT NOT NULL,
     topic TEXT NOT NULL
 );
 
@@ -100,8 +100,8 @@ CREATE INDEX topics_event_id ON topics(event_id);
 CREATE INDEX 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,
+    event_id TEXT NOT NULL,
+    room_id TEXT NOT NULL,
     name TEXT NOT NULL
 );
 
@@ -109,14 +109,14 @@ CREATE INDEX room_names_event_id ON room_names(event_id);
 CREATE INDEX room_names_room_id ON room_names(room_id);
 
 CREATE TABLE IF NOT EXISTS rooms(
-    room_id VARCHAR(150) PRIMARY KEY NOT NULL,
+    room_id TEXT PRIMARY KEY NOT NULL,
     is_public BOOL,
-    creator VARCHAR(150)
+    creator TEXT
 );
 
 CREATE TABLE IF NOT EXISTS room_hosts(
-    room_id VARCHAR(150) NOT NULL,
-    host VARCHAR(150) NOT NULL,
+    room_id TEXT NOT NULL,
+    host TEXT NOT NULL,
     UNIQUE (room_id, host)
 );
 
diff --git a/synapse/storage/schema/full_schemas/11/keys.sql b/synapse/storage/schema/full_schemas/11/keys.sql
index 459b5104272bc9d10e7af924461b32d442571676..afc142045edbb896a6606f7b7312e8805a7b07d4 100644
--- a/synapse/storage/schema/full_schemas/11/keys.sql
+++ b/synapse/storage/schema/full_schemas/11/keys.sql
@@ -13,18 +13,18 @@
  * limitations under the License.
  */
 CREATE TABLE IF NOT EXISTS server_tls_certificates(
-  server_name VARCHAR(150), -- Server name.
-  fingerprint VARCHAR(150), -- Certificate fingerprint.
-  from_server VARCHAR(150), -- Which key server the certificate was fetched from.
+  server_name TEXT, -- Server name.
+  fingerprint TEXT, -- Certificate fingerprint.
+  from_server TEXT, -- Which key server the certificate was fetched from.
   ts_added_ms BIGINT, -- When the certifcate was added.
   tls_certificate bytea, -- DER encoded x509 certificate.
   UNIQUE (server_name, fingerprint)
 );
 
 CREATE TABLE IF NOT EXISTS server_signature_keys(
-  server_name VARCHAR(150), -- Server name.
-  key_id VARCHAR(150), -- Key version.
-  from_server VARCHAR(150), -- Which key server the key was fetched form.
+  server_name TEXT, -- Server name.
+  key_id TEXT, -- Key version.
+  from_server TEXT, -- Which key server the key was fetched form.
   ts_added_ms BIGINT, -- When the key was added.
   verify_key bytea, -- NACL verification key.
   UNIQUE (server_name, key_id)
diff --git a/synapse/storage/schema/full_schemas/11/media_repository.sql b/synapse/storage/schema/full_schemas/11/media_repository.sql
index 6e0ee0db41e3d8e0680d02c73ed9f8c407deb3ed..e927e581d168a579f7d2d382e73e13a3999ee508 100644
--- a/synapse/storage/schema/full_schemas/11/media_repository.sql
+++ b/synapse/storage/schema/full_schemas/11/media_repository.sql
@@ -14,21 +14,21 @@
  */
 
 CREATE TABLE IF NOT EXISTS local_media_repository (
-    media_id VARCHAR(150), -- The id used to refer to the media.
-    media_type VARCHAR(150), -- The MIME-type of the media.
+    media_id TEXT, -- The id used to refer to the media.
+    media_type TEXT, -- The MIME-type of the media.
     media_length INTEGER, -- Length of the media in bytes.
     created_ts BIGINT, -- When the content was uploaded in ms.
-    upload_name VARCHAR(150), -- The name the media was uploaded with.
-    user_id VARCHAR(150), -- The user who uploaded the file.
+    upload_name TEXT, -- The name the media was uploaded with.
+    user_id TEXT, -- The user who uploaded the file.
     UNIQUE (media_id)
 );
 
 CREATE TABLE IF NOT EXISTS local_media_repository_thumbnails (
-    media_id VARCHAR(150), -- The id used to refer to the media.
+    media_id TEXT, -- The id used to refer to the media.
     thumbnail_width INTEGER, -- The width of the thumbnail in pixels.
     thumbnail_height INTEGER, -- The height of the thumbnail in pixels.
-    thumbnail_type VARCHAR(150), -- The MIME-type of the thumbnail.
-    thumbnail_method VARCHAR(150), -- The method used to make the thumbnail.
+    thumbnail_type TEXT, -- The MIME-type of the thumbnail.
+    thumbnail_method TEXT, -- The method used to make the thumbnail.
     thumbnail_length INTEGER, -- The length of the thumbnail in bytes.
     UNIQUE (
         media_id, thumbnail_width, thumbnail_height, thumbnail_type
@@ -39,25 +39,25 @@ CREATE INDEX local_media_repository_thumbnails_media_id
     ON local_media_repository_thumbnails (media_id);
 
 CREATE TABLE IF NOT EXISTS remote_media_cache (
-    media_origin VARCHAR(150), -- The remote HS the media came from.
-    media_id VARCHAR(150), -- The id used to refer to the media on that server.
-    media_type VARCHAR(150), -- The MIME-type of the media.
+    media_origin TEXT, -- The remote HS the media came from.
+    media_id TEXT, -- The id used to refer to the media on that server.
+    media_type TEXT, -- The MIME-type of the media.
     created_ts BIGINT, -- When the content was uploaded in ms.
-    upload_name VARCHAR(150), -- The name the media was uploaded with.
+    upload_name TEXT, -- The name the media was uploaded with.
     media_length INTEGER, -- Length of the media in bytes.
-    filesystem_id VARCHAR(150), -- The name used to store the media on disk.
+    filesystem_id TEXT, -- The name used to store the media on disk.
     UNIQUE (media_origin, media_id)
 );
 
 CREATE TABLE IF NOT EXISTS remote_media_cache_thumbnails (
-    media_origin VARCHAR(150), -- The remote HS the media came from.
-    media_id VARCHAR(150), -- The id used to refer to the media.
+    media_origin TEXT, -- The remote HS the media came from.
+    media_id TEXT, -- The id used to refer to the media.
     thumbnail_width INTEGER, -- The width of the thumbnail in pixels.
     thumbnail_height INTEGER, -- The height of the thumbnail in pixels.
-    thumbnail_method VARCHAR(150), -- The method used to make the thumbnail
-    thumbnail_type VARCHAR(150), -- The MIME-type of the thumbnail.
+    thumbnail_method TEXT, -- The method used to make the thumbnail
+    thumbnail_type TEXT, -- The MIME-type of the thumbnail.
     thumbnail_length INTEGER, -- The length of the thumbnail in bytes.
-    filesystem_id VARCHAR(150), -- The name used to store the media on disk.
+    filesystem_id TEXT, -- The name used to store the media on disk.
     UNIQUE (
         media_origin, media_id, thumbnail_width, thumbnail_height,
         thumbnail_type
diff --git a/synapse/storage/schema/full_schemas/11/presence.sql b/synapse/storage/schema/full_schemas/11/presence.sql
index fce324b8903282c7f9d3cd785d70318f1248fc52..d8d82e9fe35470889b2dec45b554f6ccfaacd52e 100644
--- a/synapse/storage/schema/full_schemas/11/presence.sql
+++ b/synapse/storage/schema/full_schemas/11/presence.sql
@@ -13,23 +13,23 @@
  * limitations under the License.
  */
 CREATE TABLE IF NOT EXISTS presence(
-  user_id VARCHAR(150) NOT NULL,
+  user_id TEXT NOT NULL,
   state VARCHAR(20),
-  status_msg VARCHAR(150),
+  status_msg TEXT,
   mtime BIGINT -- miliseconds since last state change
 );
 
 -- For each of /my/ users which possibly-remote users are allowed to see their
 -- presence state
 CREATE TABLE IF NOT EXISTS presence_allow_inbound(
-  observed_user_id VARCHAR(150) NOT NULL,
-  observer_user_id VARCHAR(150) NOT NULL -- a UserID,
+  observed_user_id TEXT NOT NULL,
+  observer_user_id TEXT NOT NULL -- a UserID,
 );
 
 -- For each of /my/ users (watcher), which possibly-remote users are they
 -- watching?
 CREATE TABLE IF NOT EXISTS presence_list(
-  user_id VARCHAR(150) NOT NULL,
-  observed_user_id VARCHAR(150) NOT NULL, -- a UserID,
+  user_id TEXT NOT NULL,
+  observed_user_id TEXT NOT NULL, -- a UserID,
   accepted BOOLEAN NOT NULL
 );
diff --git a/synapse/storage/schema/full_schemas/11/profiles.sql b/synapse/storage/schema/full_schemas/11/profiles.sql
index ffe75edf9feb751749ed60ca07aaecade2d22132..26e420443799eb0f2f56b61699613ec5236a7aca 100644
--- a/synapse/storage/schema/full_schemas/11/profiles.sql
+++ b/synapse/storage/schema/full_schemas/11/profiles.sql
@@ -13,7 +13,7 @@
  * limitations under the License.
  */
 CREATE TABLE IF NOT EXISTS profiles(
-    user_id VARCHAR(150) NOT NULL,
-    displayname VARCHAR(150),
-    avatar_url VARCHAR(150)
+    user_id TEXT NOT NULL,
+    displayname TEXT,
+    avatar_url TEXT
 );
diff --git a/synapse/storage/schema/full_schemas/11/redactions.sql b/synapse/storage/schema/full_schemas/11/redactions.sql
index 492fd2203394661803d761739ed7dbe25fac949e..69621955d46ec8664dd3f45a2f288ba8e1b46bbf 100644
--- a/synapse/storage/schema/full_schemas/11/redactions.sql
+++ b/synapse/storage/schema/full_schemas/11/redactions.sql
@@ -13,8 +13,8 @@
  * limitations under the License.
  */
 CREATE TABLE IF NOT EXISTS redactions (
-    event_id VARCHAR(150) NOT NULL,
-    redacts VARCHAR(150) NOT NULL,
+    event_id TEXT NOT NULL,
+    redacts TEXT NOT NULL,
     UNIQUE (event_id)
 );
 
diff --git a/synapse/storage/schema/full_schemas/11/room_aliases.sql b/synapse/storage/schema/full_schemas/11/room_aliases.sql
index 6226913227fa21e754084cf2d566c86a6cb6ec65..5027b1e3f616a9306360a9c61f99bfa405f26186 100644
--- a/synapse/storage/schema/full_schemas/11/room_aliases.sql
+++ b/synapse/storage/schema/full_schemas/11/room_aliases.sql
@@ -14,11 +14,11 @@
  */
 
 CREATE TABLE IF NOT EXISTS room_aliases(
-    room_alias VARCHAR(150) NOT NULL,
-    room_id VARCHAR(150) NOT NULL
+    room_alias TEXT NOT NULL,
+    room_id TEXT NOT NULL
 );
 
 CREATE TABLE IF NOT EXISTS room_alias_servers(
-    room_alias VARCHAR(150) NOT NULL,
-    server VARCHAR(150) NOT NULL
+    room_alias TEXT NOT NULL,
+    server TEXT NOT NULL
 );
diff --git a/synapse/storage/schema/full_schemas/11/state.sql b/synapse/storage/schema/full_schemas/11/state.sql
index 62c20819fd380765745e2f25d1bd386dcdaa367d..ffd164ab7122efa4b7d05d7e32726c4609cc9982 100644
--- a/synapse/storage/schema/full_schemas/11/state.sql
+++ b/synapse/storage/schema/full_schemas/11/state.sql
@@ -15,20 +15,20 @@
 
 CREATE TABLE IF NOT EXISTS state_groups(
     id INTEGER PRIMARY KEY,
-    room_id VARCHAR(150) NOT NULL,
-    event_id VARCHAR(150) NOT NULL
+    room_id TEXT NOT NULL,
+    event_id TEXT NOT NULL
 );
 
 CREATE TABLE IF NOT EXISTS state_groups_state(
     state_group INTEGER NOT NULL,
-    room_id VARCHAR(150) NOT NULL,
-    type VARCHAR(150) NOT NULL,
-    state_key VARCHAR(150) NOT NULL,
-    event_id VARCHAR(150) NOT NULL
+    room_id TEXT NOT NULL,
+    type TEXT NOT NULL,
+    state_key TEXT NOT NULL,
+    event_id TEXT NOT NULL
 );
 
 CREATE TABLE IF NOT EXISTS event_to_state_groups(
-    event_id VARCHAR(150) NOT NULL,
+    event_id TEXT NOT NULL,
     state_group INTEGER NOT NULL,
     UNIQUE (event_id)
 );
diff --git a/synapse/storage/schema/full_schemas/11/transactions.sql b/synapse/storage/schema/full_schemas/11/transactions.sql
index 524a69692089313290805eb5e73aabd080b862d1..cc5b54f5aa22e43cae4d3feb45f96f5cc96aa9ba 100644
--- a/synapse/storage/schema/full_schemas/11/transactions.sql
+++ b/synapse/storage/schema/full_schemas/11/transactions.sql
@@ -14,8 +14,8 @@
  */
 -- Stores what transaction ids we have received and what our response was
 CREATE TABLE IF NOT EXISTS received_transactions(
-    transaction_id VARCHAR(150),
-    origin VARCHAR(150),
+    transaction_id TEXT,
+    origin TEXT,
     ts BIGINT,
     response_code INTEGER,
     response_json bytea,
@@ -30,8 +30,8 @@ CREATE INDEX transactions_have_ref ON received_transactions(origin, has_been_ref
 -- since referenced the transaction in another outgoing transaction
 CREATE TABLE IF NOT EXISTS sent_transactions(
     id INTEGER PRIMARY KEY AUTOINCREMENT, -- This is used to apply insertion ordering
-    transaction_id VARCHAR(150),
-    destination VARCHAR(150),
+    transaction_id TEXT,
+    destination TEXT,
     response_code INTEGER DEFAULT 0,
     response_json TEXT,
     ts BIGINT
@@ -47,9 +47,9 @@ CREATE INDEX sent_transaction_sent ON sent_transactions(response_code);
 -- For sent transactions only.
 CREATE TABLE IF NOT EXISTS transaction_id_to_pdu(
     transaction_id INTEGER,
-    destination VARCHAR(150),
-    pdu_id VARCHAR(150),
-    pdu_origin VARCHAR(150)
+    destination TEXT,
+    pdu_id TEXT,
+    pdu_origin TEXT
 );
 
 CREATE INDEX transaction_id_to_pdu_tx ON transaction_id_to_pdu(transaction_id, destination);
@@ -57,7 +57,7 @@ CREATE INDEX transaction_id_to_pdu_dest ON transaction_id_to_pdu(destination);
 
 -- To track destination health
 CREATE TABLE IF NOT EXISTS destinations(
-    destination VARCHAR(150) PRIMARY KEY,
+    destination TEXT PRIMARY KEY,
     retry_last_ts BIGINT,
     retry_interval INTEGER
 );
diff --git a/synapse/storage/schema/full_schemas/11/users.sql b/synapse/storage/schema/full_schemas/11/users.sql
index 48a6aecfe8fd9c0d7e400d8cf6bb8a42a7443868..eec3da3c3509c8dbfe30b40fbcf4ae3f3a98cf95 100644
--- a/synapse/storage/schema/full_schemas/11/users.sql
+++ b/synapse/storage/schema/full_schemas/11/users.sql
@@ -14,8 +14,8 @@
  */
 CREATE TABLE IF NOT EXISTS users(
     id INTEGER PRIMARY KEY AUTOINCREMENT,
-    name VARCHAR(150),
-    password_hash VARCHAR(150),
+    name TEXT,
+    password_hash TEXT,
     creation_ts BIGINT,
     admin SMALLINT DEFAULT 0 NOT NULL,
     UNIQUE(name)
@@ -23,18 +23,18 @@ CREATE TABLE IF NOT EXISTS users(
 
 CREATE TABLE IF NOT EXISTS access_tokens(
     id INTEGER PRIMARY KEY AUTOINCREMENT,
-    user_id VARCHAR(150) NOT NULL,
-    device_id VARCHAR(150),
-    token VARCHAR(150) NOT NULL,
+    user_id TEXT NOT NULL,
+    device_id TEXT,
+    token TEXT NOT NULL,
     last_used BIGINT,
     UNIQUE(token)
 );
 
 CREATE TABLE IF NOT EXISTS user_ips (
-    user VARCHAR(150) NOT NULL,
-    access_token VARCHAR(150) NOT NULL,
-    device_id VARCHAR(150),
-    ip VARCHAR(150) NOT NULL,
+    user TEXT NOT NULL,
+    access_token TEXT NOT NULL,
+    device_id TEXT,
+    ip TEXT NOT NULL,
     user_agent TEXT NOT NULL,
     last_seen BIGINT NOT NULL,
     UNIQUE (user, access_token, ip, user_agent)
diff --git a/synapse/storage/schema/full_schemas/16/application_services.sql b/synapse/storage/schema/full_schemas/16/application_services.sql
index 5d63d57d591a47c4f16dec4faed0d7803b10349f..d382d63fbda4472b087c9018be4a46854fbf88c2 100644
--- a/synapse/storage/schema/full_schemas/16/application_services.sql
+++ b/synapse/storage/schema/full_schemas/16/application_services.sql
@@ -15,10 +15,10 @@
 
 CREATE TABLE IF NOT EXISTS application_services(
     id BIGINT PRIMARY KEY,
-    url VARCHAR(150),
-    token VARCHAR(150),
-    hs_token VARCHAR(150),
-    sender VARCHAR(150),
+    url TEXT,
+    token TEXT,
+    hs_token TEXT,
+    sender TEXT,
     UNIQUE(token)
 );
 
@@ -26,18 +26,18 @@ CREATE TABLE IF NOT EXISTS application_services_regex(
     id BIGINT PRIMARY KEY,
     as_id BIGINT NOT NULL,
     namespace INTEGER,  /* enum[room_id|room_alias|user_id] */
-    regex VARCHAR(150),
+    regex TEXT,
     FOREIGN KEY(as_id) REFERENCES application_services(id)
 );
 
 CREATE TABLE IF NOT EXISTS application_services_state(
-    as_id VARCHAR(150) PRIMARY KEY,
+    as_id TEXT PRIMARY KEY,
     state VARCHAR(5),
     last_txn INTEGER
 );
 
 CREATE TABLE IF NOT EXISTS application_services_txns(
-    as_id VARCHAR(150) NOT NULL,
+    as_id TEXT NOT NULL,
     txn_id INTEGER NOT NULL,
     event_ids TEXT NOT NULL,
     UNIQUE(as_id, txn_id)
diff --git a/synapse/storage/schema/full_schemas/16/event_edges.sql b/synapse/storage/schema/full_schemas/16/event_edges.sql
index 05d0874f0d309acffd232dc619df259099642105..f7020f779379a75aa285247b53e70ae53a9f0a4b 100644
--- a/synapse/storage/schema/full_schemas/16/event_edges.sql
+++ b/synapse/storage/schema/full_schemas/16/event_edges.sql
@@ -14,8 +14,8 @@
  */
 
 CREATE TABLE IF NOT EXISTS event_forward_extremities(
-    event_id VARCHAR(150) NOT NULL,
-    room_id VARCHAR(150) NOT NULL,
+    event_id TEXT NOT NULL,
+    room_id TEXT NOT NULL,
     UNIQUE (event_id, room_id)
 );
 
@@ -24,8 +24,8 @@ CREATE INDEX ev_extrem_id ON event_forward_extremities(event_id);
 
 
 CREATE TABLE IF NOT EXISTS event_backward_extremities(
-    event_id VARCHAR(150) NOT NULL,
-    room_id VARCHAR(150) NOT NULL,
+    event_id TEXT NOT NULL,
+    room_id TEXT NOT NULL,
     UNIQUE (event_id, room_id)
 );
 
@@ -34,9 +34,9 @@ CREATE INDEX ev_b_extrem_id ON event_backward_extremities(event_id);
 
 
 CREATE TABLE IF NOT EXISTS event_edges(
-    event_id VARCHAR(150) NOT NULL,
-    prev_event_id VARCHAR(150) NOT NULL,
-    room_id VARCHAR(150) NOT NULL,
+    event_id TEXT NOT NULL,
+    prev_event_id TEXT NOT NULL,
+    room_id TEXT NOT NULL,
     is_state BOOL NOT NULL,
     UNIQUE (event_id, prev_event_id, room_id, is_state)
 );
@@ -46,7 +46,7 @@ CREATE INDEX ev_edges_prev_id ON event_edges(prev_event_id);
 
 
 CREATE TABLE IF NOT EXISTS room_depth(
-    room_id VARCHAR(150) NOT NULL,
+    room_id TEXT NOT NULL,
     min_depth INTEGER NOT NULL,
     UNIQUE (room_id)
 );
@@ -55,8 +55,8 @@ CREATE INDEX room_depth_room ON room_depth(room_id);
 
 
 create TABLE IF NOT EXISTS event_destinations(
-    event_id VARCHAR(150) NOT NULL,
-    destination VARCHAR(150) NOT NULL,
+    event_id TEXT NOT NULL,
+    destination TEXT NOT NULL,
     delivered_ts BIGINT DEFAULT 0, -- or 0 if not delivered
     UNIQUE (event_id, destination)
 );
@@ -65,10 +65,10 @@ CREATE INDEX event_destinations_id ON event_destinations(event_id);
 
 
 CREATE TABLE IF NOT EXISTS state_forward_extremities(
-    event_id VARCHAR(150) NOT NULL,
-    room_id VARCHAR(150) NOT NULL,
-    type VARCHAR(150) NOT NULL,
-    state_key VARCHAR(150) NOT NULL,
+    event_id TEXT NOT NULL,
+    room_id TEXT NOT NULL,
+    type TEXT NOT NULL,
+    state_key TEXT NOT NULL,
     UNIQUE (event_id, room_id)
 );
 
@@ -79,9 +79,9 @@ CREATE INDEX st_extrem_id ON state_forward_extremities(event_id);
 
 
 CREATE TABLE IF NOT EXISTS event_auth(
-    event_id VARCHAR(150) NOT NULL,
-    auth_id VARCHAR(150) NOT NULL,
-    room_id VARCHAR(150) NOT NULL,
+    event_id TEXT NOT NULL,
+    auth_id TEXT NOT NULL,
+    room_id TEXT NOT NULL,
     UNIQUE (event_id, auth_id, room_id)
 );
 
diff --git a/synapse/storage/schema/full_schemas/16/event_signatures.sql b/synapse/storage/schema/full_schemas/16/event_signatures.sql
index 429182736814da22fbb2cde78118a64f658a0238..636b2d3353a435334ccc6472743ddd8b0590c3c0 100644
--- a/synapse/storage/schema/full_schemas/16/event_signatures.sql
+++ b/synapse/storage/schema/full_schemas/16/event_signatures.sql
@@ -14,8 +14,8 @@
  */
 
 CREATE TABLE IF NOT EXISTS event_content_hashes (
-    event_id VARCHAR(150),
-    algorithm VARCHAR(150),
+    event_id TEXT,
+    algorithm TEXT,
     hash bytea,
     UNIQUE (event_id, algorithm)
 );
@@ -24,8 +24,8 @@ CREATE INDEX event_content_hashes_id ON event_content_hashes(event_id);
 
 
 CREATE TABLE IF NOT EXISTS event_reference_hashes (
-    event_id VARCHAR(150),
-    algorithm VARCHAR(150),
+    event_id TEXT,
+    algorithm TEXT,
     hash bytea,
     UNIQUE (event_id, algorithm)
 );
@@ -34,9 +34,9 @@ CREATE INDEX event_reference_hashes_id ON event_reference_hashes(event_id);
 
 
 CREATE TABLE IF NOT EXISTS event_signatures (
-    event_id VARCHAR(150),
-    signature_name VARCHAR(150),
-    key_id VARCHAR(150),
+    event_id TEXT,
+    signature_name TEXT,
+    key_id TEXT,
     signature bytea,
     UNIQUE (event_id, signature_name, key_id)
 );
@@ -45,9 +45,9 @@ CREATE INDEX event_signatures_id ON event_signatures(event_id);
 
 
 CREATE TABLE IF NOT EXISTS event_edge_hashes(
-    event_id VARCHAR(150),
-    prev_event_id VARCHAR(150),
-    algorithm VARCHAR(150),
+    event_id TEXT,
+    prev_event_id TEXT,
+    algorithm TEXT,
     hash bytea,
     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 5b4b4944849a7f5534b01f85e196163a22711f25..576653a3c9e68101313b8ff32f6f73803fe057cd 100644
--- a/synapse/storage/schema/full_schemas/16/im.sql
+++ b/synapse/storage/schema/full_schemas/16/im.sql
@@ -16,9 +16,9 @@
 CREATE TABLE IF NOT EXISTS events(
     stream_ordering INTEGER PRIMARY KEY,
     topological_ordering BIGINT NOT NULL,
-    event_id VARCHAR(150) NOT NULL,
-    type VARCHAR(150) NOT NULL,
-    room_id VARCHAR(150) NOT NULL,
+    event_id TEXT NOT NULL,
+    type TEXT NOT NULL,
+    room_id TEXT NOT NULL,
     content TEXT NOT NULL,
     unrecognized_keys TEXT,
     processed BOOL NOT NULL,
@@ -37,8 +37,8 @@ CREATE INDEX events_order_room ON events (
 
 
 CREATE TABLE IF NOT EXISTS event_json(
-    event_id VARCHAR(150) NOT NULL,
-    room_id VARCHAR(150) NOT NULL,
+    event_id TEXT NOT NULL,
+    room_id TEXT NOT NULL,
     internal_metadata TEXT NOT NULL,
     json TEXT NOT NULL,
     UNIQUE (event_id)
@@ -48,11 +48,11 @@ CREATE INDEX event_json_room_id ON event_json(room_id);
 
 
 CREATE TABLE IF NOT EXISTS state_events(
-    event_id VARCHAR(150) NOT NULL,
-    room_id VARCHAR(150) NOT NULL,
-    type VARCHAR(150) NOT NULL,
-    state_key VARCHAR(150) NOT NULL,
-    prev_state VARCHAR(150),
+    event_id TEXT NOT NULL,
+    room_id TEXT NOT NULL,
+    type TEXT NOT NULL,
+    state_key TEXT NOT NULL,
+    prev_state TEXT,
     UNIQUE (event_id)
 );
 
@@ -62,10 +62,10 @@ CREATE INDEX state_events_state_key ON state_events (state_key);
 
 
 CREATE TABLE IF NOT EXISTS current_state_events(
-    event_id VARCHAR(150) NOT NULL,
-    room_id VARCHAR(150) NOT NULL,
-    type VARCHAR(150) NOT NULL,
-    state_key VARCHAR(150) NOT NULL,
+    event_id TEXT NOT NULL,
+    room_id TEXT NOT NULL,
+    type TEXT NOT NULL,
+    state_key TEXT NOT NULL,
     UNIQUE (event_id),
     UNIQUE (room_id, type, state_key)
 );
@@ -75,11 +75,11 @@ CREATE INDEX current_state_events_type ON current_state_events (type);
 CREATE INDEX current_state_events_state_key ON current_state_events (state_key);
 
 CREATE TABLE IF NOT EXISTS room_memberships(
-    event_id VARCHAR(150) NOT NULL,
-    user_id VARCHAR(150) NOT NULL,
-    sender VARCHAR(150) NOT NULL,
-    room_id VARCHAR(150) NOT NULL,
-    membership VARCHAR(150) NOT NULL,
+    event_id TEXT NOT NULL,
+    user_id TEXT NOT NULL,
+    sender TEXT NOT NULL,
+    room_id TEXT NOT NULL,
+    membership TEXT NOT NULL,
     UNIQUE (event_id)
 );
 
@@ -87,17 +87,17 @@ CREATE INDEX room_memberships_room_id ON room_memberships (room_id);
 CREATE INDEX room_memberships_user_id ON room_memberships (user_id);
 
 CREATE TABLE IF NOT EXISTS feedback(
-    event_id VARCHAR(150) NOT NULL,
-    feedback_type VARCHAR(150),
-    target_event_id VARCHAR(150),
-    sender VARCHAR(150),
-    room_id VARCHAR(150),
+    event_id TEXT NOT NULL,
+    feedback_type TEXT,
+    target_event_id TEXT,
+    sender TEXT,
+    room_id TEXT,
     UNIQUE (event_id)
 );
 
 CREATE TABLE IF NOT EXISTS topics(
-    event_id VARCHAR(150) NOT NULL,
-    room_id VARCHAR(150) NOT NULL,
+    event_id TEXT NOT NULL,
+    room_id TEXT NOT NULL,
     topic TEXT NOT NULL,
     UNIQUE (event_id)
 );
@@ -105,8 +105,8 @@ CREATE TABLE IF NOT EXISTS topics(
 CREATE INDEX 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,
+    event_id TEXT NOT NULL,
+    room_id TEXT NOT NULL,
     name TEXT NOT NULL,
     UNIQUE (event_id)
 );
@@ -114,14 +114,14 @@ CREATE TABLE IF NOT EXISTS room_names(
 CREATE INDEX room_names_room_id ON room_names(room_id);
 
 CREATE TABLE IF NOT EXISTS rooms(
-    room_id VARCHAR(150) PRIMARY KEY NOT NULL,
+    room_id TEXT PRIMARY KEY NOT NULL,
     is_public BOOL,
-    creator VARCHAR(150)
+    creator TEXT
 );
 
 CREATE TABLE IF NOT EXISTS room_hosts(
-    room_id VARCHAR(150) NOT NULL,
-    host VARCHAR(150) NOT NULL,
+    room_id TEXT NOT NULL,
+    host TEXT NOT NULL,
     UNIQUE (room_id, host)
 );
 
diff --git a/synapse/storage/schema/full_schemas/16/keys.sql b/synapse/storage/schema/full_schemas/16/keys.sql
index 459b5104272bc9d10e7af924461b32d442571676..afc142045edbb896a6606f7b7312e8805a7b07d4 100644
--- a/synapse/storage/schema/full_schemas/16/keys.sql
+++ b/synapse/storage/schema/full_schemas/16/keys.sql
@@ -13,18 +13,18 @@
  * limitations under the License.
  */
 CREATE TABLE IF NOT EXISTS server_tls_certificates(
-  server_name VARCHAR(150), -- Server name.
-  fingerprint VARCHAR(150), -- Certificate fingerprint.
-  from_server VARCHAR(150), -- Which key server the certificate was fetched from.
+  server_name TEXT, -- Server name.
+  fingerprint TEXT, -- Certificate fingerprint.
+  from_server TEXT, -- Which key server the certificate was fetched from.
   ts_added_ms BIGINT, -- When the certifcate was added.
   tls_certificate bytea, -- DER encoded x509 certificate.
   UNIQUE (server_name, fingerprint)
 );
 
 CREATE TABLE IF NOT EXISTS server_signature_keys(
-  server_name VARCHAR(150), -- Server name.
-  key_id VARCHAR(150), -- Key version.
-  from_server VARCHAR(150), -- Which key server the key was fetched form.
+  server_name TEXT, -- Server name.
+  key_id TEXT, -- Key version.
+  from_server TEXT, -- Which key server the key was fetched form.
   ts_added_ms BIGINT, -- When the key was added.
   verify_key bytea, -- NACL verification key.
   UNIQUE (server_name, key_id)
diff --git a/synapse/storage/schema/full_schemas/16/media_repository.sql b/synapse/storage/schema/full_schemas/16/media_repository.sql
index 0e819fca38eb8d46a522eba6cbeed8683393bb20..dacbda40ca8e20ca7746e86e9915e5b54967109b 100644
--- a/synapse/storage/schema/full_schemas/16/media_repository.sql
+++ b/synapse/storage/schema/full_schemas/16/media_repository.sql
@@ -14,21 +14,21 @@
  */
 
 CREATE TABLE IF NOT EXISTS local_media_repository (
-    media_id VARCHAR(150), -- The id used to refer to the media.
-    media_type VARCHAR(150), -- The MIME-type of the media.
+    media_id TEXT, -- The id used to refer to the media.
+    media_type TEXT, -- The MIME-type of the media.
     media_length INTEGER, -- Length of the media in bytes.
     created_ts BIGINT, -- When the content was uploaded in ms.
-    upload_name VARCHAR(150), -- The name the media was uploaded with.
-    user_id VARCHAR(150), -- The user who uploaded the file.
+    upload_name TEXT, -- The name the media was uploaded with.
+    user_id TEXT, -- The user who uploaded the file.
     UNIQUE (media_id)
 );
 
 CREATE TABLE IF NOT EXISTS local_media_repository_thumbnails (
-    media_id VARCHAR(150), -- The id used to refer to the media.
+    media_id TEXT, -- The id used to refer to the media.
     thumbnail_width INTEGER, -- The width of the thumbnail in pixels.
     thumbnail_height INTEGER, -- The height of the thumbnail in pixels.
-    thumbnail_type VARCHAR(150), -- The MIME-type of the thumbnail.
-    thumbnail_method VARCHAR(150), -- The method used to make the thumbnail.
+    thumbnail_type TEXT, -- The MIME-type of the thumbnail.
+    thumbnail_method TEXT, -- The method used to make the thumbnail.
     thumbnail_length INTEGER, -- The length of the thumbnail in bytes.
     UNIQUE (
         media_id, thumbnail_width, thumbnail_height, thumbnail_type
@@ -39,25 +39,25 @@ CREATE INDEX local_media_repository_thumbnails_media_id
     ON local_media_repository_thumbnails (media_id);
 
 CREATE TABLE IF NOT EXISTS remote_media_cache (
-    media_origin VARCHAR(150), -- The remote HS the media came from.
-    media_id VARCHAR(150), -- The id used to refer to the media on that server.
-    media_type VARCHAR(150), -- The MIME-type of the media.
+    media_origin TEXT, -- The remote HS the media came from.
+    media_id TEXT, -- The id used to refer to the media on that server.
+    media_type TEXT, -- The MIME-type of the media.
     created_ts BIGINT, -- When the content was uploaded in ms.
-    upload_name VARCHAR(150), -- The name the media was uploaded with.
+    upload_name TEXT, -- The name the media was uploaded with.
     media_length INTEGER, -- Length of the media in bytes.
-    filesystem_id VARCHAR(150), -- The name used to store the media on disk.
+    filesystem_id TEXT, -- The name used to store the media on disk.
     UNIQUE (media_origin, media_id)
 );
 
 CREATE TABLE IF NOT EXISTS remote_media_cache_thumbnails (
-    media_origin VARCHAR(150), -- The remote HS the media came from.
-    media_id VARCHAR(150), -- The id used to refer to the media.
+    media_origin TEXT, -- The remote HS the media came from.
+    media_id TEXT, -- The id used to refer to the media.
     thumbnail_width INTEGER, -- The width of the thumbnail in pixels.
     thumbnail_height INTEGER, -- The height of the thumbnail in pixels.
-    thumbnail_method VARCHAR(150), -- The method used to make the thumbnail
-    thumbnail_type VARCHAR(150), -- The MIME-type of the thumbnail.
+    thumbnail_method TEXT, -- The method used to make the thumbnail
+    thumbnail_type TEXT, -- The MIME-type of the thumbnail.
     thumbnail_length INTEGER, -- The length of the thumbnail in bytes.
-    filesystem_id VARCHAR(150), -- The name used to store the media on disk.
+    filesystem_id TEXT, -- The name used to store the media on disk.
     UNIQUE (
         media_origin, media_id, thumbnail_width, thumbnail_height,
         thumbnail_type
diff --git a/synapse/storage/schema/full_schemas/16/presence.sql b/synapse/storage/schema/full_schemas/16/presence.sql
index 9c41be296ea6b29547f09ee6529f20c681099588..80088413baf23eaf3d33c20895f2e947c9a9d543 100644
--- a/synapse/storage/schema/full_schemas/16/presence.sql
+++ b/synapse/storage/schema/full_schemas/16/presence.sql
@@ -13,9 +13,9 @@
  * limitations under the License.
  */
 CREATE TABLE IF NOT EXISTS presence(
-  user_id VARCHAR(150) NOT NULL,
+  user_id TEXT NOT NULL,
   state VARCHAR(20),
-  status_msg VARCHAR(150),
+  status_msg TEXT,
   mtime BIGINT, -- miliseconds since last state change
   UNIQUE (user_id)
 );
@@ -23,16 +23,16 @@ CREATE TABLE IF NOT EXISTS presence(
 -- For each of /my/ users which possibly-remote users are allowed to see their
 -- presence state
 CREATE TABLE IF NOT EXISTS presence_allow_inbound(
-  observed_user_id VARCHAR(150) NOT NULL,
-  observer_user_id VARCHAR(150) NOT NULL, -- a UserID,
+  observed_user_id TEXT NOT NULL,
+  observer_user_id TEXT NOT NULL, -- a UserID,
   UNIQUE (observed_user_id, observer_user_id)
 );
 
 -- For each of /my/ users (watcher), which possibly-remote users are they
 -- watching?
 CREATE TABLE IF NOT EXISTS presence_list(
-  user_id VARCHAR(150) NOT NULL,
-  observed_user_id VARCHAR(150) NOT NULL, -- a UserID,
+  user_id TEXT NOT NULL,
+  observed_user_id TEXT NOT NULL, -- a UserID,
   accepted BOOLEAN NOT NULL,
   UNIQUE (user_id, observed_user_id)
 );
diff --git a/synapse/storage/schema/full_schemas/16/profiles.sql b/synapse/storage/schema/full_schemas/16/profiles.sql
index 21c58a99bcd745d443a83d01a291dfd4be8cda61..934be86520d3cfbf01c97f4c5635e2f32587adaa 100644
--- a/synapse/storage/schema/full_schemas/16/profiles.sql
+++ b/synapse/storage/schema/full_schemas/16/profiles.sql
@@ -13,8 +13,8 @@
  * limitations under the License.
  */
 CREATE TABLE IF NOT EXISTS profiles(
-    user_id VARCHAR(150) NOT NULL,
-    displayname VARCHAR(150),
-    avatar_url VARCHAR(150),
+    user_id TEXT NOT NULL,
+    displayname TEXT,
+    avatar_url TEXT,
     UNIQUE(user_id)
 );
diff --git a/synapse/storage/schema/full_schemas/16/push.sql b/synapse/storage/schema/full_schemas/16/push.sql
index 5c0c7bc2010d755107973456dacbcc82820bbaa9..db6e05cbdfc739ab430cea1ae2654604dfa19480 100644
--- a/synapse/storage/schema/full_schemas/16/push.sql
+++ b/synapse/storage/schema/full_schemas/16/push.sql
@@ -14,16 +14,16 @@
  */
 
 CREATE TABLE IF NOT EXISTS rejections(
-    event_id VARCHAR(150) NOT NULL,
-    reason VARCHAR(150) NOT NULL,
-    last_check VARCHAR(150) NOT NULL,
+    event_id TEXT NOT NULL,
+    reason TEXT NOT NULL,
+    last_check TEXT NOT NULL,
     UNIQUE (event_id)
 );
 
 -- Push notification endpoints that users have configured
 CREATE TABLE IF NOT EXISTS pushers (
   id BIGINT PRIMARY KEY,
-  user_name VARCHAR(150) NOT NULL,
+  user_name TEXT NOT NULL,
   profile_tag VARCHAR(32) NOT NULL,
   kind VARCHAR(8) NOT NULL,
   app_id VARCHAR(64) NOT NULL,
@@ -41,19 +41,19 @@ CREATE TABLE IF NOT EXISTS pushers (
 
 CREATE TABLE IF NOT EXISTS push_rules (
   id BIGINT PRIMARY KEY,
-  user_name VARCHAR(150) NOT NULL,
-  rule_id VARCHAR(150) NOT NULL,
+  user_name TEXT NOT NULL,
+  rule_id TEXT NOT NULL,
   priority_class SMALLINT NOT NULL,
   priority INTEGER NOT NULL DEFAULT 0,
-  conditions VARCHAR(150) NOT NULL,
-  actions VARCHAR(150) NOT NULL,
+  conditions TEXT NOT NULL,
+  actions TEXT NOT NULL,
   UNIQUE(user_name, rule_id)
 );
 
 CREATE INDEX push_rules_user_name on push_rules (user_name);
 
 CREATE TABLE IF NOT EXISTS user_filters(
-  user_id VARCHAR(150),
+  user_id TEXT,
   filter_id BIGINT,
   filter_json bytea
 );
@@ -64,8 +64,8 @@ CREATE INDEX user_filters_by_user_id_filter_id ON user_filters(
 
 CREATE TABLE IF NOT EXISTS push_rules_enable (
   id BIGINT PRIMARY KEY,
-  user_name VARCHAR(150) NOT NULL,
-  rule_id VARCHAR(150) NOT NULL,
+  user_name TEXT NOT NULL,
+  rule_id TEXT NOT NULL,
   enabled SMALLINT,
   UNIQUE(user_name, rule_id)
 );
diff --git a/synapse/storage/schema/full_schemas/16/redactions.sql b/synapse/storage/schema/full_schemas/16/redactions.sql
index 492fd2203394661803d761739ed7dbe25fac949e..69621955d46ec8664dd3f45a2f288ba8e1b46bbf 100644
--- a/synapse/storage/schema/full_schemas/16/redactions.sql
+++ b/synapse/storage/schema/full_schemas/16/redactions.sql
@@ -13,8 +13,8 @@
  * limitations under the License.
  */
 CREATE TABLE IF NOT EXISTS redactions (
-    event_id VARCHAR(150) NOT NULL,
-    redacts VARCHAR(150) NOT NULL,
+    event_id TEXT NOT NULL,
+    redacts TEXT NOT NULL,
     UNIQUE (event_id)
 );
 
diff --git a/synapse/storage/schema/full_schemas/16/room_aliases.sql b/synapse/storage/schema/full_schemas/16/room_aliases.sql
index 2c0853a2a934ea9bb091bcf86ef308eb5f0a7a3c..412bb97fad74fe7390dd2d1909711e756a4eac9c 100644
--- a/synapse/storage/schema/full_schemas/16/room_aliases.sql
+++ b/synapse/storage/schema/full_schemas/16/room_aliases.sql
@@ -14,16 +14,16 @@
  */
 
 CREATE TABLE IF NOT EXISTS room_aliases(
-    room_alias VARCHAR(150) NOT NULL,
-    room_id VARCHAR(150) NOT NULL,
+    room_alias TEXT NOT NULL,
+    room_id TEXT NOT NULL,
     UNIQUE (room_alias)
 );
 
 CREATE INDEX room_aliases_id ON room_aliases(room_id);
 
 CREATE TABLE IF NOT EXISTS room_alias_servers(
-    room_alias VARCHAR(150) NOT NULL,
-    server VARCHAR(150) NOT NULL
+    room_alias TEXT NOT NULL,
+    server TEXT NOT NULL
 );
 
 CREATE INDEX room_alias_servers_alias ON room_alias_servers(room_alias);
diff --git a/synapse/storage/schema/full_schemas/16/state.sql b/synapse/storage/schema/full_schemas/16/state.sql
index b0cd5ee75ab8b95eae02a1702c02dbabf07109bb..705cac6ce9d4cd1fe0297da5350f667feb667c04 100644
--- a/synapse/storage/schema/full_schemas/16/state.sql
+++ b/synapse/storage/schema/full_schemas/16/state.sql
@@ -15,20 +15,20 @@
 
 CREATE TABLE IF NOT EXISTS state_groups(
     id BIGINT PRIMARY KEY,
-    room_id VARCHAR(150) NOT NULL,
-    event_id VARCHAR(150) NOT NULL
+    room_id TEXT NOT NULL,
+    event_id TEXT NOT NULL
 );
 
 CREATE TABLE IF NOT EXISTS state_groups_state(
     state_group BIGINT NOT NULL,
-    room_id VARCHAR(150) NOT NULL,
-    type VARCHAR(150) NOT NULL,
-    state_key VARCHAR(150) NOT NULL,
-    event_id VARCHAR(150) NOT NULL
+    room_id TEXT NOT NULL,
+    type TEXT NOT NULL,
+    state_key TEXT NOT NULL,
+    event_id TEXT NOT NULL
 );
 
 CREATE TABLE IF NOT EXISTS event_to_state_groups(
-    event_id VARCHAR(150) NOT NULL,
+    event_id TEXT NOT NULL,
     state_group BIGINT NOT NULL,
     UNIQUE (event_id)
 );
diff --git a/synapse/storage/schema/full_schemas/16/transactions.sql b/synapse/storage/schema/full_schemas/16/transactions.sql
index ed431bd3af45bd244d637fcbb8bdb96db382b14b..1ab77cdb63c60e788246594f1ebc03e0b6dadb88 100644
--- a/synapse/storage/schema/full_schemas/16/transactions.sql
+++ b/synapse/storage/schema/full_schemas/16/transactions.sql
@@ -14,8 +14,8 @@
  */
 -- Stores what transaction ids we have received and what our response was
 CREATE TABLE IF NOT EXISTS received_transactions(
-    transaction_id VARCHAR(150),
-    origin VARCHAR(150),
+    transaction_id TEXT,
+    origin TEXT,
     ts BIGINT,
     response_code INTEGER,
     response_json bytea,
@@ -30,8 +30,8 @@ CREATE INDEX transactions_have_ref ON received_transactions(origin, has_been_ref
 -- since referenced the transaction in another outgoing transaction
 CREATE TABLE IF NOT EXISTS sent_transactions(
     id BIGINT PRIMARY KEY, -- This is used to apply insertion ordering
-    transaction_id VARCHAR(150),
-    destination VARCHAR(150),
+    transaction_id TEXT,
+    destination TEXT,
     response_code INTEGER DEFAULT 0,
     response_json TEXT,
     ts BIGINT
@@ -47,9 +47,9 @@ CREATE INDEX sent_transaction_sent ON sent_transactions(response_code);
 -- For sent transactions only.
 CREATE TABLE IF NOT EXISTS transaction_id_to_pdu(
     transaction_id INTEGER,
-    destination VARCHAR(150),
-    pdu_id VARCHAR(150),
-    pdu_origin VARCHAR(150),
+    destination TEXT,
+    pdu_id TEXT,
+    pdu_origin TEXT,
     UNIQUE (transaction_id, destination)
 );
 
@@ -57,7 +57,7 @@ CREATE INDEX transaction_id_to_pdu_dest ON transaction_id_to_pdu(destination);
 
 -- To track destination health
 CREATE TABLE IF NOT EXISTS destinations(
-    destination VARCHAR(150) PRIMARY KEY,
+    destination TEXT PRIMARY KEY,
     retry_last_ts BIGINT,
     retry_interval INTEGER
 );
diff --git a/synapse/storage/schema/full_schemas/16/users.sql b/synapse/storage/schema/full_schemas/16/users.sql
index 033e3244b5b52749f8e0ef15da4432fe06c6d758..d2fa3122da78f64ac3e37a3c1ae17bd9010b3016 100644
--- a/synapse/storage/schema/full_schemas/16/users.sql
+++ b/synapse/storage/schema/full_schemas/16/users.sql
@@ -13,8 +13,8 @@
  * limitations under the License.
  */
 CREATE TABLE IF NOT EXISTS users(
-    name VARCHAR(150),
-    password_hash VARCHAR(150),
+    name TEXT,
+    password_hash TEXT,
     creation_ts BIGINT,
     admin SMALLINT DEFAULT 0 NOT NULL,
     UNIQUE(name)
@@ -22,18 +22,18 @@ CREATE TABLE IF NOT EXISTS users(
 
 CREATE TABLE IF NOT EXISTS access_tokens(
     id BIGINT PRIMARY KEY,
-    user_id VARCHAR(150) NOT NULL,
-    device_id VARCHAR(150),
-    token VARCHAR(150) NOT NULL,
+    user_id TEXT NOT NULL,
+    device_id TEXT,
+    token TEXT NOT NULL,
     last_used BIGINT,
     UNIQUE(token)
 );
 
 CREATE TABLE IF NOT EXISTS user_ips (
-    user_id VARCHAR(150) NOT NULL,
-    access_token VARCHAR(150) NOT NULL,
-    device_id VARCHAR(150),
-    ip VARCHAR(150) NOT NULL,
+    user_id TEXT NOT NULL,
+    access_token TEXT NOT NULL,
+    device_id TEXT,
+    ip TEXT NOT NULL,
     user_agent TEXT NOT NULL,
     last_seen BIGINT NOT NULL
 );
diff --git a/synapse/storage/schema/schema_version.sql b/synapse/storage/schema/schema_version.sql
index d9494611e0e364924b05fbbbdc34f9fcb8c1fb27..d682608aa00c2cb6e0b981d4b01129e603fddd31 100644
--- a/synapse/storage/schema/schema_version.sql
+++ b/synapse/storage/schema/schema_version.sql
@@ -22,6 +22,6 @@ CREATE TABLE IF NOT EXISTS schema_version(
 
 CREATE TABLE IF NOT EXISTS applied_schema_deltas(
     version INTEGER NOT NULL,
-    file VARCHAR(150) NOT NULL,
+    file TEXT NOT NULL,
     UNIQUE(version, file)
 );