codegen db

This commit is contained in:
Brandon Thomas committed 2022-01-12 01:42:53 -05:00
1 parent 0a27c79ee3
commit c8bfb1f2f0
5 files changed
+32 -3

No files matched your search

Generated
+1
View File
@@ -3764,6 +3764,7 @@ dependencies = [
"config",
"container_common",
"data-encoding",
"database_queries",
"derive_more",
"diesel",
"dotenv",
+2 -2
View File
@@ -1,11 +1,11 @@
#!/bin/bash
# Necessary since we're now in a more complex Rust workspace
pushd crates/app/storyteller_web
pushd crates/service/storyteller_web
SQLX_OFFLINE=true cargo sqlx prepare -- --bin storyteller-web
popd
mv crates/app/storyteller_web/sqlx-data.json .
mv crates/service/storyteller_web/sqlx-data.json .
@@ -40,6 +40,7 @@ path = "src/w2l_inference_job.rs"
# Internal
config = { path = "../../lib/config" }
container_common = { path = "../../lib/container_common" }
database_queries = { path = "../../lib/database_queries" }
http_server_common = { path = "../../lib/http_server_common" }
# External
+8 -1
View File
@@ -28,6 +28,13 @@ pub mod validations;
// NB: This is included so sqlx can generate all the queries.
mod job_queries;
// NB: Also so sqlx codegens everything.
// Not sure if this is strictly necessary.
mod shared_queries {
use database_queries::twitch_oauth::find;
use database_queries::twitch_oauth::insert;
}
use actix_cors::Cors;
use actix_http::http;
use actix_web::middleware::{Logger, DefaultHeaders};
@@ -98,6 +105,7 @@ use crate::http_server::middleware::ip_filter_middleware::IpFilter;
use crate::http_server::web_utils::cookie_manager::CookieManager;
use crate::http_server::web_utils::redis_rate_limiter::RedisRateLimiter;
use crate::http_server::web_utils::session_checker::SessionChecker;
use crate::routes::add_routes;
use crate::server_state::{ServerState, EnvConfig};
use crate::threads::ip_banlist_set::IpBanlistSet;
use crate::threads::poll_ip_banlist_thread::poll_ip_bans;
@@ -116,7 +124,6 @@ use sqlx::mysql::MySqlPoolOptions;
use std::sync::Arc;
use std::time::Duration;
use tokio::runtime::Runtime;
use crate::routes::add_routes;
// TODO TODO TODO TODO
// TODO TODO TODO TODO
+20
View File
@@ -375,6 +375,16 @@
]
}
},
"05030f800d4e16abedc75fd0697711e9396a0eae783ad86a86dd7c0540a4d489": {
"query": "\nINSERT INTO twitch_oauth_tokens\nSET\n maybe_user_token = ?,\n twitch_user_id = ?,\n maybe_twitch_username = ?,\n access_token = ?,\n maybe_refresh_token = ?,\n token_type = ?,\n expires_in_seconds = ?,\n has_bits_read = ?,\n has_channel_read_subscriptions = ?,\n has_channel_read_redemptions= ?,\n has_user_read_follows = ?,\n ip_address_creation = ?,\n expires_at = DATE_ADD(NOW(), INTERVAL ? SECOND)\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 13
},
"nullable": []
}
},
"05612e384bdce558e4834c720d1eb7ca9a09e3cca64b72f1497929d860345ec7": {
"query": "\nSELECT\n tts.token as model_token,\n tts.tts_model_type,\n tts.creator_user_token,\n users.username as creator_username,\n users.display_name as creator_display_name,\n users.email_gravatar_hash as creator_gravatar_hash,\n tts.title,\n tts.is_locked_from_use,\n tts.created_at,\n tts.updated_at\nFROM tts_models as tts\nJOIN users\nON\n users.token = tts.creator_user_token\nWHERE\n users.username = ?\n AND tts.is_locked_from_use IS FALSE\n AND tts.user_deleted_at IS NULL\n AND tts.mod_deleted_at IS NULL\n ",
"describe": {
@@ -5960,6 +5970,16 @@
"nullable": []
}
},
"91beefeb04c0baafe4c3983c2760df2e5d08ea5e2433225221d20da8d2dca114": {
"query": "\nINSERT INTO twitch_oauth_tokens\nSET\n maybe_user_token = ?,\n twitch_user_id = ?,\n maybe_twitch_username = ?,\n access_token = ?,\n maybe_refresh_token = ?,\n token_type = ?,\n expires_in_seconds = NULL,\n has_bits_read = ?,\n has_channel_read_subscriptions = ?,\n has_channel_read_redemptions= ?,\n has_user_read_follows = ?,\n ip_address_creation = ?,\n expires_at = NULL\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 11
},
"nullable": []
}
},
"961f792c24bee6009e3e8a215561db932871a53c48839b8cb80292de00e7b2e1": {
"query": "\nUPDATE tts_results\nSET\n user_deleted_at = CURRENT_TIMESTAMP\nWHERE\n token = ?\nLIMIT 1\n ",
"describe": {