Skip to content

Commit

Permalink
Removed unnecessary macros.
Browse files Browse the repository at this point in the history
  • Loading branch information
SamTV12345 committed Nov 8, 2023
1 parent e9157cc commit 4766af1
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 25 deletions.
7 changes: 0 additions & 7 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,9 @@ use std::process::Command;


fn main() {
#[cfg(feature = "sqlite")]
println!("cargo:rustc-cfg=sqlite");
#[cfg(feature = "mysql")]
println!("cargo:rustc-cfg=mysql");
#[cfg(feature = "postgresql")]
println!("cargo:rustc-cfg=postgresql");
let maybe_vaultwarden_version =
env::var("VW_VERSION").or_else(|_| env::var("BWRS_VERSION")).or_else(|_| version_from_git_info());

#[cfg(feature = "postgresql")]
version_from_git_info().expect("Error retrieving git information");

create_git_sqlite();
Expand Down
2 changes: 0 additions & 2 deletions src/config/dbconfig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use std::process::exit;
use std::time::Duration;
use crate::constants::inner_constants::{DATABASE_URL, DATABASE_URL_DEFAULT_SQLITE};
use crate::dbconfig::DBType;
#[cfg(sqlite)]
use crate::DBType as DbConnection;

#[derive(Debug)]
Expand All @@ -14,7 +13,6 @@ pub struct ConnectionOptions {
pub busy_timeout: Option<Duration>,
}

#[cfg(sqlite)]
impl r2d2::CustomizeConnection<DbConnection, diesel::r2d2::Error>
for ConnectionOptions
{
Expand Down
15 changes: 0 additions & 15 deletions src/dbconfig/mod.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,6 @@
#[path = "schemas/sqlite/schema.rs"]
pub mod schema;

#[cfg(mysql)]
#[path = "schemas/mysql/schema.rs"]
pub mod schema;


#[macro_export]
#[cfg(mysql)]
macro_rules! import_database_connections {
() => {
use diesel::MysqlConnection;
};
}

#[derive(diesel::MultiConnection)]
pub enum DBType {
Postgresql(diesel::PgConnection),
Expand All @@ -23,11 +10,9 @@ pub enum DBType {
#[macro_export]
macro_rules! import_database_config{
()=>{
#[cfg(sqlite)]
pub const SQLITE_MIGRATIONS: EmbeddedMigrations = embed_migrations!("./migrations/sqlite");


#[cfg(postgresql)]
pub const POSTGRES_MIGRATIONS: EmbeddedMigrations = embed_migrations!("./migrations/postgres");
}
}
Expand Down
1 change: 0 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ use regex::Regex;
use tokio::task::spawn_blocking;

mod controllers;
#[cfg(sqlite)]
use crate::config::dbconfig::{ConnectionOptions};
use crate::config::dbconfig::{establish_connection, get_database_url};
use crate::constants::inner_constants::{BASIC_AUTH, CSS, JS, OIDC_AUTH, OIDC_CLIENT_ID, OIDC_JWKS, TELEGRAM_API_ENABLED, TELEGRAM_BOT_CHAT_ID, TELEGRAM_BOT_TOKEN};
Expand Down

0 comments on commit 4766af1

Please sign in to comment.