Fix slop in DB code.

Removed extraneous embedded migrations, added explicit relative path to migrations folder, removed hardcoded folder in diesel.toml
This commit is contained in:
Nicole Tietz-Sokolskaya 2024-06-05 20:54:06 -04:00
parent 0611aac45f
commit 30473344af
3 changed files with 2 additions and 5 deletions

View file

@ -6,4 +6,4 @@ file = "src/schema.rs"
custom_type_derives = ["diesel::query_builder::QueryId", "Clone"] custom_type_derives = ["diesel::query_builder::QueryId", "Clone"]
[migrations_directory] [migrations_directory]
dir = "/home/nicole/Code/pique/migrations" dir = "./migrations"

View file

@ -3,7 +3,7 @@ use diesel::r2d2::{ConnectionManager, Pool};
use diesel::SqliteConnection; use diesel::SqliteConnection;
use diesel_migrations::{embed_migrations, EmbeddedMigrations, MigrationHarness}; use diesel_migrations::{embed_migrations, EmbeddedMigrations, MigrationHarness};
pub const MIGRATIONS: EmbeddedMigrations = embed_migrations!(); pub const MIGRATIONS: EmbeddedMigrations = embed_migrations!("./migrations/");
/// Establishes a connection to the database using the given URL. /// Establishes a connection to the database using the given URL.
/// ///

View file

@ -5,7 +5,6 @@ use axum::routing::{get, post};
use axum::Router; use axum::Router;
use axum_login::AuthManagerLayerBuilder; use axum_login::AuthManagerLayerBuilder;
use clap::Parser; use clap::Parser;
use diesel_migrations::{embed_migrations, EmbeddedMigrations};
use tower_http::services::ServeDir; use tower_http::services::ServeDir;
use tower_http::trace::{DefaultOnRequest, DefaultOnResponse, TraceLayer}; use tower_http::trace::{DefaultOnRequest, DefaultOnResponse, TraceLayer};
use tower_sessions::SessionManagerLayer; use tower_sessions::SessionManagerLayer;
@ -27,8 +26,6 @@ use crate::logging::setup_logging;
use crate::provider::Provider; use crate::provider::Provider;
use crate::templates::make_template_loader; use crate::templates::make_template_loader;
pub const MIGRATIONS: EmbeddedMigrations = embed_migrations!("./migrations/");
pub async fn run() -> Result<()> { pub async fn run() -> Result<()> {
dotenvy::dotenv()?; dotenvy::dotenv()?;
setup_logging(); setup_logging();