Move database migrations to SQLx
This commit is contained in:
parent
4edcee2567
commit
31ee6b4540
1
.idea/sqldialects.xml
generated
1
.idea/sqldialects.xml
generated
@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="SqlDialectMappings">
|
||||
<file url="file://$PROJECT_DIR$/migrations/00-initial.sql" dialect="GenericSQL" />
|
||||
<file url="PROJECT" dialect="MySQL" />
|
||||
</component>
|
||||
</project>
|
809
Cargo.lock
generated
809
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -7,11 +7,11 @@ edition = "2018"
|
||||
[dependencies]
|
||||
songbird = { version = "0.3", features = ["builtin-queue"] }
|
||||
poise = "0.3"
|
||||
sqlx = { version = "0.5", default-features = false, features = ["runtime-tokio-rustls", "macros", "mysql", "bigdecimal"] }
|
||||
sqlx = { version = "0.5", default-features = false, features = ["runtime-tokio-rustls", "macros", "mysql", "bigdecimal", "migrate"] }
|
||||
tokio = { version = "1", features = ["fs", "process", "io-util"] }
|
||||
lazy_static = "1.4"
|
||||
reqwest = "0.11"
|
||||
env_logger = "0.9"
|
||||
env_logger = "0.10"
|
||||
regex = "1.4"
|
||||
log = "0.4"
|
||||
serde_json = "1.0"
|
||||
@ -20,3 +20,6 @@ serde = "1.0"
|
||||
|
||||
[patch."https://github.com/serenity-rs/serenity"]
|
||||
serenity = { version = "0.11.5" }
|
||||
|
||||
[package.metadata.deb]
|
||||
depends = ["$auto", "ffmpeg", "libopus-dev"]
|
||||
|
3
build.rs
Normal file
3
build.rs
Normal file
@ -0,0 +1,3 @@
|
||||
fn main() {
|
||||
println!("cargo:rerun-if-changed=migrations");
|
||||
}
|
@ -66,7 +66,6 @@ pub async fn register_application_commands(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// entry point
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
||||
env_logger::init();
|
||||
@ -129,6 +128,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
sqlx::migrate!().run(&database).await?;
|
||||
|
||||
poise::Framework::builder()
|
||||
.token(discord_token)
|
||||
.user_data_setup(move |ctx, _bot, framework| {
|
||||
|
Loading…
Reference in New Issue
Block a user