From ce83c99420e6bead649ef16ae3eb203a3af0faf7 Mon Sep 17 00:00:00 2001 From: erik Date: Mon, 14 Jun 2021 14:33:57 +0000 Subject: [PATCH] Change data types according to sqlx Co-authored-by: Elias Schriefer --- src/sqlite/external_servers_preferences.sql | 2 +- src/sqlite/external_servers_privacy_preferences.sql | 2 +- src/sqlite/notification_preferences.sql | 6 +++--- src/sqlite/privacy_preferences.sql | 4 ++-- src/sqlite/security_preferences.sql | 2 +- src/sqlite/users.sql | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/sqlite/external_servers_preferences.sql b/src/sqlite/external_servers_preferences.sql index 83944f5..00b72e4 100644 --- a/src/sqlite/external_servers_preferences.sql +++ b/src/sqlite/external_servers_preferences.sql @@ -1,7 +1,7 @@ -- external_servers_preferences definition CREATE TABLE external_servers_preferences ( - id INTEGER NOT NULL PRIMARY KEY, + id BLOB NOT NULL PRIMARY KEY, external_servers BLOB NOT NULL, external_servers_limit TEXT NOT NULL, CONSTRAINT external_servers_preferences_FK FOREIGN KEY (id) REFERENCES users(id) ON DELETE CASCADE ON UPDATE CASCADE diff --git a/src/sqlite/external_servers_privacy_preferences.sql b/src/sqlite/external_servers_privacy_preferences.sql index 9ea5a44..43c530c 100644 --- a/src/sqlite/external_servers_privacy_preferences.sql +++ b/src/sqlite/external_servers_privacy_preferences.sql @@ -1,7 +1,7 @@ -- external_servers_privacy_preferences definition CREATE TABLE external_servers_privacy_preferences ( - id INTEGER NOT NULL PRIMARY KEY, + id BLOB NOT NULL PRIMARY KEY, discovery BLOB NOT NULL, discovery_user_limit TEXT NOT NULL, discovery_server_limit TEXT NOT NULL, diff --git a/src/sqlite/notification_preferences.sql b/src/sqlite/notification_preferences.sql index 36ab5d7..498b232 100644 --- a/src/sqlite/notification_preferences.sql +++ b/src/sqlite/notification_preferences.sql @@ -1,8 +1,8 @@ -- notification_preferences definition CREATE TABLE notification_preferences ( - id INTEGER NOT NULL PRIMARY KEY, - lock_details INTEGER DEFAULT 0 NOT NULL, - do_not_disturb INTEGER DEFAULT 0 NOT NULL, + id BLOB NOT NULL PRIMARY KEY, + lock_details BOOLEAN DEFAULT 0 NOT NULL CHECK (lock_details IN (0, 1)), + do_not_disturb INTEGER DEFAULT 0 NOT NULL CHECK (do_not_disturb IN (0, 1)), CONSTRAINT notification_preferences_FK FOREIGN KEY (id) REFERENCES users(id) ON DELETE CASCADE ON UPDATE CASCADE ); \ No newline at end of file diff --git a/src/sqlite/privacy_preferences.sql b/src/sqlite/privacy_preferences.sql index 28cfd21..445bf03 100644 --- a/src/sqlite/privacy_preferences.sql +++ b/src/sqlite/privacy_preferences.sql @@ -1,14 +1,14 @@ -- privacy_preferences definition CREATE TABLE privacy_preferences ( - id INTEGER NOT NULL PRIMARY KEY, + id BLOB NOT NULL PRIMARY KEY, discovery BLOB NOT NULL, discovery_user_limit TEXT NOT NULL, discovery_server_limit TEXT NOT NULL, last_seen BLOB NOT NULL, last_seen_user_limit TEXT NOT NULL, last_seen_server_limit TEXT NOT NULL, - last_seen_course INTEGER DEFAULT 0 NOT NULL, + last_seen_course BOOLEAN DEFAULT 0 NOT NULL CHECK (last_seen_course IN (0, 1)), info BLOB NOT NULL, info_user_limit TEXT NOT NULL, info_server_limit TEXT NOT NULL, diff --git a/src/sqlite/security_preferences.sql b/src/sqlite/security_preferences.sql index 9ce04a5..50ce979 100644 --- a/src/sqlite/security_preferences.sql +++ b/src/sqlite/security_preferences.sql @@ -1,7 +1,7 @@ -- security_preferences definition CREATE TABLE "security_preferences" ( - id INTEGER NOT NULL PRIMARY KEY, + id BLOB NOT NULL PRIMARY KEY, account_tokens TEXT NOT NULL, password_hash TEXT NOT NULL, CONSTRAINT NewTable_FK FOREIGN KEY (id) REFERENCES users(id) ON DELETE CASCADE ON UPDATE CASCADE diff --git a/src/sqlite/users.sql b/src/sqlite/users.sql index 4dfc8c6..66500e7 100644 --- a/src/sqlite/users.sql +++ b/src/sqlite/users.sql @@ -1,10 +1,10 @@ -- users definition CREATE TABLE users ( - id INTEGER NOT NULL PRIMARY KEY, + id BLOB NOT NULL PRIMARY KEY, user_name TEXT NOT NULL, display_name TEXT, - activated INTEGER DEFAULT 0 NOT NULL, + activated BOOLEAN DEFAULT 0 NOT NULL CHECK (activated IN (0, 1)), created INTEGER NOT NULL, last_online INTEGER ); \ No newline at end of file