db_sqlite: use TEXT instead of VARCHAR
VARCHAR(n) is pointless in SQLite and is the same as TEXT. Don't bother with a migration since they're equivalent. Also remove some unnecessary DEFAULT NULL statements.
This commit is contained in:
parent
07c962018d
commit
ce3d6df6b8
42
db_sqlite.go
42
db_sqlite.go
@ -17,27 +17,27 @@ const sqliteQueryTimeout = 5 * time.Second
|
||||
const sqliteSchema = `
|
||||
CREATE TABLE User (
|
||||
id INTEGER PRIMARY KEY,
|
||||
username VARCHAR(255) NOT NULL UNIQUE,
|
||||
password VARCHAR(255),
|
||||
username TEXT NOT NULL UNIQUE,
|
||||
password TEXT,
|
||||
admin INTEGER NOT NULL DEFAULT 0,
|
||||
realname VARCHAR(255)
|
||||
realname TEXT
|
||||
);
|
||||
|
||||
CREATE TABLE Network (
|
||||
id INTEGER PRIMARY KEY,
|
||||
name VARCHAR(255),
|
||||
name TEXT,
|
||||
user INTEGER NOT NULL,
|
||||
addr VARCHAR(255) NOT NULL,
|
||||
nick VARCHAR(255) NOT NULL,
|
||||
username VARCHAR(255),
|
||||
realname VARCHAR(255),
|
||||
pass VARCHAR(255),
|
||||
connect_commands VARCHAR(1023),
|
||||
sasl_mechanism VARCHAR(255),
|
||||
sasl_plain_username VARCHAR(255),
|
||||
sasl_plain_password VARCHAR(255),
|
||||
sasl_external_cert BLOB DEFAULT NULL,
|
||||
sasl_external_key BLOB DEFAULT NULL,
|
||||
addr TEXT NOT NULL,
|
||||
nick TEXT NOT NULL,
|
||||
username TEXT,
|
||||
realname TEXT,
|
||||
pass TEXT,
|
||||
connect_commands TEXT,
|
||||
sasl_mechanism TEXT,
|
||||
sasl_plain_username TEXT,
|
||||
sasl_plain_password TEXT,
|
||||
sasl_external_cert BLOB,
|
||||
sasl_external_key BLOB,
|
||||
enabled INTEGER NOT NULL DEFAULT 1,
|
||||
FOREIGN KEY(user) REFERENCES User(id),
|
||||
UNIQUE(user, addr, nick),
|
||||
@ -47,10 +47,10 @@ CREATE TABLE Network (
|
||||
CREATE TABLE Channel (
|
||||
id INTEGER PRIMARY KEY,
|
||||
network INTEGER NOT NULL,
|
||||
name VARCHAR(255) NOT NULL,
|
||||
key VARCHAR(255),
|
||||
name TEXT NOT NULL,
|
||||
key TEXT,
|
||||
detached INTEGER NOT NULL DEFAULT 0,
|
||||
detached_internal_msgid VARCHAR(255),
|
||||
detached_internal_msgid TEXT,
|
||||
relay_detached INTEGER NOT NULL DEFAULT 0,
|
||||
reattach_on INTEGER NOT NULL DEFAULT 0,
|
||||
detach_after INTEGER NOT NULL DEFAULT 0,
|
||||
@ -62,9 +62,9 @@ CREATE TABLE Channel (
|
||||
CREATE TABLE DeliveryReceipt (
|
||||
id INTEGER PRIMARY KEY,
|
||||
network INTEGER NOT NULL,
|
||||
target VARCHAR(255) NOT NULL,
|
||||
client VARCHAR(255),
|
||||
internal_msgid VARCHAR(255) NOT NULL,
|
||||
target TEXT NOT NULL,
|
||||
client TEXT,
|
||||
internal_msgid TEXT NOT NULL,
|
||||
FOREIGN KEY(network) REFERENCES Network(id),
|
||||
UNIQUE(network, target, client)
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user