Change ID fields in SQL to be unique

This commit is contained in:
2021-12-10 22:54:22 +01:00
parent a669c9cfd9
commit 9bc103018e
4 changed files with 31 additions and 31 deletions

View File

@@ -1,6 +1,6 @@
-- chat index table
CREATE TABLE IF NOT EXISTS chat_index (
id TEXT NOT NULL,
id TEXT NOT NULL UNIQUE,
is_group_chat BOOLEAN DEFAULT 0 NOT NULL CHECK (is_group_chat IN (0, 1)),
title TEXT NOT NULL,
description TEXT,

View File

@@ -1,7 +1,7 @@
-- msgdata_template definition
-- TODO Add IF NOT EXISTS to prevent panics
CREATE TABLE msgdata_{chat_id} (
msg_id TEXT NOT NULL,
msg_id TEXT NOT NULL UNIQUE,
timestamp INTEGER NOT NULL,
sender_id TEXT NOT NULL,
msg_type INTEGER NOT NULL,

View File

@@ -2,7 +2,7 @@
CREATE TABLE IF NOT EXISTS users (
id TEXT NOT NULL PRIMARY KEY,
user_name TEXT NOT NULL,
user_name TEXT NOT NULL UNIQUE,
display_name TEXT,
activated BOOLEAN DEFAULT 0 NOT NULL CHECK (activated IN (0, 1)),
created INTEGER NOT NULL,