diff --git a/src/routes.rs b/src/routes.rs index 80723f5..4fe2f0a 100644 --- a/src/routes.rs +++ b/src/routes.rs @@ -1,10 +1,11 @@ use std::sync::Arc; -use axum::{Json, Form, Router, routing::{put, post, get}, extract::{State, Query}, response::{Redirect, Html}}; +use axum::{Json, Form, Router, routing::{put, post, get}, extract::{State, Query}, response::Redirect}; use crate::{notifications::NotificationProcessor, model::{Page, PageOptions, PageInsertion, PageView}, storage::StorageProvider, config::ConfigRouting}; pub fn create_router_with_app_routes(state: Context) -> Router { + #[allow(unused_mut)] let mut router = Router::new() .route("/api", get(get_suggestion)) .route("/api", post(send_suggestion_form)) @@ -14,6 +15,7 @@ pub fn create_router_with_app_routes(state: Context) -> Router { { use sailfish::TemplateOnce; use axum_extra::response::{Css, JavaScript}; + use axum::response::Html; let template = crate::web::IndexTemplate::from(&state.template) .render_once() diff --git a/src/storage.rs b/src/storage.rs index d4d07ec..92f14ed 100644 --- a/src/storage.rs +++ b/src/storage.rs @@ -27,6 +27,7 @@ pub struct StorageProvider { // https://github.com/launchbadge/sqlx/issues/2778 // so the `public` field is an integer which is ridicolous +#[cfg(any(feature = "sqlite", feature = "mysql"))] const SQLITE_SCHEMA : &str = " CREATE TABLE IF NOT EXISTS pages ( id INTEGER PRIMARY KEY AUTOINCREMENT, @@ -36,8 +37,9 @@ CREATE TABLE IF NOT EXISTS pages ( timestamp INTEGER NOT NULL, public INTEGER NOT NULL ); -"; +"; // TODO make schema specific for mysql +#[cfg(feature = "postgres")] const POSTGRES_SCHEMA : &str = " CREATE TABLE IF NOT EXISTS pages ( id SERIAL PRIMARY KEY,