🔥 Remove SeaORM database support
This commit is contained in:
parent
e157576581
commit
90d4d5cde0
18 changed files with 2 additions and 1334 deletions
|
|
@ -3,9 +3,6 @@ use crate::core::package::PackageRef;
|
|||
use crate::core::theme::all::THEMES;
|
||||
use crate::{config, service, service_for_static_files, static_files, trace};
|
||||
|
||||
#[cfg(feature = "database")]
|
||||
use crate::db::*;
|
||||
|
||||
use std::sync::{LazyLock, RwLock};
|
||||
|
||||
static_files!(base);
|
||||
|
|
@ -130,45 +127,6 @@ pub fn init_packages() {
|
|||
}
|
||||
}
|
||||
|
||||
// RUN MIGRATIONS **********************************************************************************
|
||||
|
||||
#[cfg(feature = "database")]
|
||||
pub fn run_migrations() {
|
||||
if let Some(dbconn) = &*DBCONN {
|
||||
if let Err(e) = run_now({
|
||||
struct Migrator;
|
||||
impl MigratorTrait for Migrator {
|
||||
fn migrations() -> Vec<MigrationItem> {
|
||||
let mut migrations = vec![];
|
||||
for m in ENABLED_PACKAGES.read().unwrap().iter() {
|
||||
migrations.append(&mut m.migrations());
|
||||
}
|
||||
migrations
|
||||
}
|
||||
}
|
||||
Migrator::up(SchemaManagerConnection::Connection(dbconn), None)
|
||||
}) {
|
||||
trace::error!("Database upgrade failed ({})", e);
|
||||
};
|
||||
|
||||
if let Err(e) = run_now({
|
||||
struct Migrator;
|
||||
impl MigratorTrait for Migrator {
|
||||
fn migrations() -> Vec<MigrationItem> {
|
||||
let mut migrations = vec![];
|
||||
for m in DROPPED_PACKAGES.read().unwrap().iter() {
|
||||
migrations.append(&mut m.migrations());
|
||||
}
|
||||
migrations
|
||||
}
|
||||
}
|
||||
Migrator::down(SchemaManagerConnection::Connection(dbconn), None)
|
||||
}) {
|
||||
trace::error!("Database downgrade failed ({})", e);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// CONFIGURE SERVICES ******************************************************************************
|
||||
|
||||
pub fn configure_services(scfg: &mut service::web::ServiceConfig) {
|
||||
|
|
|
|||
|
|
@ -4,9 +4,6 @@ use crate::core::AnyBase;
|
|||
use crate::locale::L10n;
|
||||
use crate::{actions, service};
|
||||
|
||||
#[cfg(feature = "database")]
|
||||
use crate::{db::MigrationItem, migrations};
|
||||
|
||||
pub type PackageRef = &'static dyn PackageTrait;
|
||||
|
||||
/// Los paquetes deben implementar este *trait*.
|
||||
|
|
@ -35,11 +32,6 @@ pub trait PackageTrait: AnyBase + Send + Sync {
|
|||
actions![]
|
||||
}
|
||||
|
||||
#[cfg(feature = "database")]
|
||||
fn migrations(&self) -> Vec<MigrationItem> {
|
||||
migrations![]
|
||||
}
|
||||
|
||||
fn init(&self) {}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue