Merge pull request 'inteligentsql' (#10) from inteligentsql into main
Reviewed-on: #10
This commit is contained in:
commit
b8a12fcd42
@ -1,8 +1,8 @@
|
|||||||
-- external_servers_preferences definition
|
-- external_servers_preferences definition
|
||||||
|
|
||||||
CREATE TABLE external_servers_preferences (
|
CREATE TABLE IF NOT EXISTS external_servers_preferences (
|
||||||
id TEXT NOT NULL PRIMARY KEY,
|
id TEXT NOT NULL PRIMARY KEY,
|
||||||
external_servers BLOB NOT NULL,
|
external_servers BLOB NOT NULL,
|
||||||
external_servers_limit TEXT 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
|
CONSTRAINT external_servers_preferences_FK FOREIGN KEY (id) REFERENCES users(id) ON DELETE CASCADE ON UPDATE CASCADE
|
||||||
);
|
);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
-- external_servers_privacy_preferences definition
|
-- external_servers_privacy_preferences definition
|
||||||
|
|
||||||
CREATE TABLE external_servers_privacy_preferences (
|
CREATE TABLE IF NOT EXISTS external_servers_privacy_preferences (
|
||||||
id TEXT NOT NULL PRIMARY KEY,
|
id TEXT NOT NULL PRIMARY KEY,
|
||||||
discovery BLOB NOT NULL,
|
discovery BLOB NOT NULL,
|
||||||
discovery_user_limit TEXT NOT NULL,
|
discovery_user_limit TEXT NOT NULL,
|
||||||
@ -13,4 +13,4 @@ CREATE TABLE external_servers_privacy_preferences (
|
|||||||
info_user_limit TEXT NOT NULL,
|
info_user_limit TEXT NOT NULL,
|
||||||
info_server_limit TEXT NOT NULL,
|
info_server_limit TEXT NOT NULL,
|
||||||
CONSTRAINT external_servers_privacy_preferences_FK FOREIGN KEY (id) REFERENCES users(id) ON DELETE CASCADE ON UPDATE CASCADE
|
CONSTRAINT external_servers_privacy_preferences_FK FOREIGN KEY (id) REFERENCES users(id) ON DELETE CASCADE ON UPDATE CASCADE
|
||||||
);
|
);
|
||||||
|
@ -25,4 +25,13 @@ pub async fn load_template(sqlite_handle: &SqlitePool) -> sqlx::Result<SqliteQue
|
|||||||
include_str!("external_servers_privacy_preferences.sql"),
|
include_str!("external_servers_privacy_preferences.sql"),
|
||||||
include_str!("external_servers_preferences.sql"),
|
include_str!("external_servers_preferences.sql"),
|
||||||
)).execute(sqlite_handle).await
|
)).execute(sqlite_handle).await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub async fn add_test_user(sqlite_handle: &mut SqliteConnection)-> sqlx::Result<SqliteQueryResult>{
|
||||||
|
sqlx::query("insert into users values('1923123','Elierik','erikeli',1,2,3);").execute(sqlite_handle).await
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn sqlite_out(sqlite_handle: &mut SqliteConnection, query:&str, index:usize) -> Result<String, sqlx::Error> {
|
||||||
|
sqlx::query(query).fetch_one(sqlite_handle).await.unwrap().try_get(index)
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
-- notification_preferences definition
|
-- notification_preferences definition
|
||||||
|
|
||||||
CREATE TABLE notification_preferences (
|
CREATE TABLE IF NOT EXISTS notification_preferences (
|
||||||
id TEXT NOT NULL PRIMARY KEY,
|
id TEXT NOT NULL PRIMARY KEY,
|
||||||
lock_details BOOLEAN DEFAULT 0 NOT NULL CHECK (lock_details IN (0, 1)),
|
lock_details BOOLEAN DEFAULT 0 NOT NULL CHECK (lock_details IN (0, 1)),
|
||||||
do_not_disturb BOOLEAN DEFAULT 0 NOT NULL CHECK (do_not_disturb IN (0, 1)),
|
do_not_disturb BOOLEAN 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
|
CONSTRAINT notification_preferences_FK FOREIGN KEY (id) REFERENCES users(id) ON DELETE CASCADE ON UPDATE CASCADE
|
||||||
);
|
);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
-- privacy_preferences definition
|
-- privacy_preferences definition
|
||||||
|
|
||||||
CREATE TABLE privacy_preferences (
|
CREATE TABLE IF NOT EXISTS privacy_preferences (
|
||||||
id TEXT NOT NULL PRIMARY KEY,
|
id TEXT NOT NULL PRIMARY KEY,
|
||||||
discovery BLOB NOT NULL,
|
discovery BLOB NOT NULL,
|
||||||
discovery_user_limit TEXT NOT NULL,
|
discovery_user_limit TEXT NOT NULL,
|
||||||
@ -13,4 +13,4 @@ CREATE TABLE privacy_preferences (
|
|||||||
info_user_limit TEXT NOT NULL,
|
info_user_limit TEXT NOT NULL,
|
||||||
info_server_limit TEXT NOT NULL,
|
info_server_limit TEXT NOT NULL,
|
||||||
CONSTRAINT privacy_preferences_FK FOREIGN KEY (id) REFERENCES users(id) ON DELETE CASCADE ON UPDATE CASCADE
|
CONSTRAINT privacy_preferences_FK FOREIGN KEY (id) REFERENCES users(id) ON DELETE CASCADE ON UPDATE CASCADE
|
||||||
);
|
);
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
-- security_preferences definition
|
-- security_preferences definition
|
||||||
|
|
||||||
CREATE TABLE "security_preferences" (
|
CREATE TABLE IF NOT EXISTS "security_preferences" (
|
||||||
id TEXT NOT NULL PRIMARY KEY,
|
id TEXT NOT NULL PRIMARY KEY,
|
||||||
account_tokens TEXT NOT NULL,
|
account_tokens TEXT NOT NULL,
|
||||||
password_hash TEXT NOT NULL,
|
password_hash TEXT NOT NULL,
|
||||||
CONSTRAINT NewTable_FK FOREIGN KEY (id) REFERENCES users(id) ON DELETE CASCADE ON UPDATE CASCADE
|
CONSTRAINT NewTable_FK FOREIGN KEY (id) REFERENCES users(id) ON DELETE CASCADE ON UPDATE CASCADE
|
||||||
);
|
);
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
-- users definition
|
-- users definition
|
||||||
|
|
||||||
CREATE TABLE users (
|
CREATE TABLE IF NOT EXISTS users (
|
||||||
id TEXT NOT NULL PRIMARY KEY,
|
id TEXT NOT NULL PRIMARY KEY,
|
||||||
user_name TEXT NOT NULL,
|
user_name TEXT NOT NULL,
|
||||||
display_name TEXT,
|
display_name TEXT,
|
||||||
activated BOOLEAN DEFAULT 0 NOT NULL CHECK (activated IN (0, 1)),
|
activated BOOLEAN DEFAULT 0 NOT NULL CHECK (activated IN (0, 1)),
|
||||||
created INTEGER NOT NULL,
|
created INTEGER NOT NULL,
|
||||||
last_online INTEGER
|
last_online INTEGER
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user