add NOT NULL constraints

This commit is contained in:
Evgeny Poberezkin
2021-01-03 12:47:12 +00:00
parent 6526e421e8
commit 3d4f43a051
@@ -12,8 +12,8 @@ servers =
[s|
CREATE TABLE IF NOT EXISTS servers
( server_id INTEGER PRIMARY KEY,
host_address TEXT,
port INT,
host_address TEXT NOT NULL,
port INT NOT NULL,
key_hash BLOB,
UNIQUE (host_address, port)
)
@@ -25,15 +25,17 @@ recipientQueues =
[s|
CREATE TABLE IF NOT EXISTS recipient_queues
( recipient_queue_id INTEGER PRIMARY KEY,
server_id INTEGER REFERENCES servers(server_id),
rcv_id BLOB,
rcv_private_key BLOB,
server_id INTEGER REFERENCES servers(server_id) NOT NULL,
rcv_id BLOB NOT NULL,
rcv_private_key BLOB NOT NULL,
snd_id BLOB,
snd_key BLOB,
decrypt_key BLOB,
decrypt_key BLOB NOT NULL,
verify_key BLOB,
status TEXT,
ack_mode INTEGER
status TEXT NOT NULL,
ack_mode INTEGER NOT NULL,
UNIQUE (server_id, rcv_id),
UNIQUE (server_id, snd_id)
)
|]
@@ -42,13 +44,13 @@ senderQueues =
[s|
CREATE TABLE IF NOT EXISTS sender_queues
( sender_queue_id INTEGER PRIMARY KEY,
server_id INTEGER REFERENCES servers(server_id),
snd_id BLOB,
snd_private_key BLOB,
encrypt_key BLOB,
sign_key BLOB,
status TEXT,
ack_mode INTEGER
server_id INTEGER REFERENCES servers(server_id) NOT NULL,
snd_id BLOB NOT NULL,
snd_private_key BLOB NOT NULL,
encrypt_key BLOB NOT NULL,
sign_key BLOB NOT NULL,
status TEXT NOT NULL,
ack_mode INTEGER NOT NULL
)
|]
@@ -69,11 +71,11 @@ messages =
CREATE TABLE IF NOT EXISTS messages
( message_id INTEGER PRIMARY KEY,
conn_alias TEXT REFERENCES connections(conn_alias),
agent_msg_id INTEGER,
timestamp TEXT,
message TEXT,
direction TEXT,
msg_status TEXT
agent_msg_id INTEGER NOT NULL,
timestamp TEXT NOT NULL,
message BLOB NOT NULL,
direction TEXT NOT NULL,
msg_status TEXT NOT NULL
)
|]