From 595ea874652cdb7c84a5241b1ffc812ea85f4a3b Mon Sep 17 00:00:00 2001 From: Philipp Heckel Date: Fri, 31 Dec 2021 16:19:41 +0100 Subject: [PATCH] Switch VARCHAR(N) to TEXT, as they are equivalent in SQLite --- server/cache_sqlite.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/server/cache_sqlite.go b/server/cache_sqlite.go index 82d0907..b057289 100644 --- a/server/cache_sqlite.go +++ b/server/cache_sqlite.go @@ -15,13 +15,13 @@ const ( createMessagesTableQuery = ` BEGIN; CREATE TABLE IF NOT EXISTS messages ( - id VARCHAR(20) PRIMARY KEY, + id TEXT PRIMARY KEY, time INT NOT NULL, - topic VARCHAR(64) NOT NULL, - message VARCHAR(512) NOT NULL, - title VARCHAR(256) NOT NULL, + topic TEXT NOT NULL, + message TEXT NOT NULL, + title TEXT NOT NULL, priority INT NOT NULL, - tags VARCHAR(256) NOT NULL, + tags TEXT NOT NULL, published INT NOT NULL ); CREATE INDEX IF NOT EXISTS idx_topic ON messages (topic); @@ -68,9 +68,9 @@ const ( // 0 -> 1 migrate0To1AlterMessagesTableQuery = ` BEGIN; - ALTER TABLE messages ADD COLUMN title VARCHAR(256) NOT NULL DEFAULT(''); + ALTER TABLE messages ADD COLUMN title TEXT NOT NULL DEFAULT(''); ALTER TABLE messages ADD COLUMN priority INT NOT NULL DEFAULT(0); - ALTER TABLE messages ADD COLUMN tags VARCHAR(256) NOT NULL DEFAULT(''); + ALTER TABLE messages ADD COLUMN tags TEXT NOT NULL DEFAULT(''); COMMIT; `