diff --git a/akd/crates/publisher/Cargo.toml b/akd/crates/publisher/Cargo.toml new file mode 100644 index 0000000000..3028583ecc --- /dev/null +++ b/akd/crates/publisher/Cargo.toml @@ -0,0 +1,25 @@ +[package] +name = "publisher" +edition.workspace = true +version.workspace = true +authors.workspace = true +license-file.workspace = true +keywords.workspace = true + +[dependencies] +akd_storage = { path = "../akd_storage" } +tokio-util = {version = "0.7.16", features = ["compat"] } +tokio = { workspace = true } +tracing = { workspace = true } +tracing-subscriber = { workspace = true } +async-std = {version = "1.13.2", features = ["attributes"] } + +[target.'cfg(target_os = "macos")'.dependencies] +tiberius = { version = "0.12.3", default-features = false, features = ["chrono", "tokio", "rustls"] } + +[target.'cfg(not(target_os = "macos"))'.workspace.dependencies] +tiberius = { version = "0.12.3", features = ["chrono", "tokio"] } + + +[lints] +workspace = true diff --git a/akd/crates/publisher/src/main.rs b/akd/crates/publisher/src/main.rs new file mode 100644 index 0000000000..667c2eb7eb --- /dev/null +++ b/akd/crates/publisher/src/main.rs @@ -0,0 +1,19 @@ +use tracing::{info, trace}; + +#[tokio::main] +async fn main() { + tracing_subscriber::fmt() + .with_max_level(tracing::Level::TRACE) + .init(); + + // Read connection string from env var + let connection_string = std::env::var("AKD_MSSQL_CONNECTION_STRING").expect("AKD_MSSQL_CONNECTION_STRING must be set."); + + let mssql = akd_storage::ms_sql::MsSql::builder(connection_string) + .pool_size(10) + .build() + .await + .expect("Failed to create MsSql instance"); + + mssql.migrate().await.expect("Failed to run migrations"); +}