From 799a1ff49e94296b719a6b1cc8f69320cd6cd344 Mon Sep 17 00:00:00 2001 From: Radical Date: Wed, 30 Apr 2025 11:11:19 +0000 Subject: [PATCH] fix: use raw_sql instead of .execute --- src/main.rs | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/main.rs b/src/main.rs index f25a34a..e0a82ac 100644 --- a/src/main.rs +++ b/src/main.rs @@ -26,15 +26,22 @@ async fn main() -> Result<(), Error> { TODO: Figure out if a table should be used here and if not then what. Also figure out if these should be different types from what they currently are and if we should add more "constraints" */ - pool.execute(r#"CREATE TABLE IF NOT EXISTS users ( - uuid uuid UNIQUE NOT NULL, - username varchar(32) UNIQUE NOT NULL, - display_name varchar(64), - password varchar(512) NOT NULL, - email varchar(100) UNIQUE NOT NULL, - email_verified integer NOT NULL DEFAULT '0', - PRIMARY KEY (uuid) - )"#).await?; + sqlx::raw_sql(r#" + CREATE TABLE IF NOT EXISTS users ( + uuid uuid PRIMARY KEY UNIQUE NOT NULL, + username varchar(32) UNIQUE NOT NULL, + display_name varchar(64), + password varchar(512) NOT NULL, + email varchar(100) UNIQUE NOT NULL, + email_verified boolean NOT NULL DEFAULT FALSE + ); + CREATE TABLE IF NOT EXISTS instance_permissions ( + uuid uuid REFERENCES users(uuid), + administrator boolean NOT NULL DEFAULT FALSE + ) + "#) + .execute(&pool) + .await?; let data = Data { pool,