feat: deployment #46
@ -7,18 +7,21 @@ mod server;
|
||||
mod query;
|
||||
mod utils;
|
||||
mod internationalization;
|
||||
mod migrations;
|
||||
|
||||
use components::app::App;
|
||||
use dioxus::prelude::*;
|
||||
use dioxus_logger::tracing::{info, Level};
|
||||
|
||||
fn main() {
|
||||
dioxus_logger::init(Level::INFO).expect("failed to initialize logger");
|
||||
info!("starting app");
|
||||
dioxus_logger::init(Level::INFO).expect("Failed to initialize the logger.");
|
||||
|
||||
info!("Running migrations.");
|
||||
migrations::run_migrations().expect("Failed to run migrations.");
|
||||
|
||||
info!("Starting app.");
|
||||
let cfg = server_only!(
|
||||
dioxus::fullstack::Config::new().addr(std::net::SocketAddr::from(([0, 0, 0, 0], 8000)))
|
||||
);
|
||||
|
||||
LaunchBuilder::fullstack().with_cfg(cfg).launch(App);
|
||||
}
|
||||
|
12
src/migrations/mod.rs
Normal file
12
src/migrations/mod.rs
Normal file
@ -0,0 +1,12 @@
|
||||
use diesel_migrations::{embed_migrations, EmbeddedMigrations, MigrationHarness};
|
||||
use std::error::Error;
|
||||
|
||||
const MIGRATIONS: EmbeddedMigrations = embed_migrations!("migrations");
|
||||
|
||||
pub(crate) fn run_migrations() -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
|
||||
let mut connection = crate::server::database_connection::establish_database_connection()?;
|
||||
|
||||
connection.run_pending_migrations(MIGRATIONS)?;
|
||||
|
||||
Ok(())
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
mod database_connection;
|
||||
pub(crate) mod database_connection;
|
||||
pub(crate) mod projects;
|
||||
pub(crate) mod tasks;
|
||||
pub(crate) mod subtasks;
|
||||
|
Loading…
x
Reference in New Issue
Block a user