mirror of
https://github.com/LemmyNet/lemmy.git
synced 2025-01-05 14:48:55 +00:00
Revert "Move embedded migrations to separate crate"
This reverts commit 44b1049970
.
This commit is contained in:
parent
44b1049970
commit
3883fb5671
9 changed files with 7 additions and 41 deletions
8
Cargo.lock
generated
8
Cargo.lock
generated
|
@ -2637,13 +2637,6 @@ dependencies = [
|
|||
"uuid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lemmy_db_migrations"
|
||||
version = "0.17.1"
|
||||
dependencies = [
|
||||
"diesel_migrations",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lemmy_db_schema"
|
||||
version = "0.17.1"
|
||||
|
@ -2659,7 +2652,6 @@ dependencies = [
|
|||
"diesel-derive-newtype",
|
||||
"diesel_ltree",
|
||||
"diesel_migrations",
|
||||
"lemmy_db_migrations",
|
||||
"lemmy_utils",
|
||||
"once_cell",
|
||||
"regex",
|
||||
|
|
|
@ -45,7 +45,6 @@ members = [
|
|||
"crates/db_views",
|
||||
"crates/db_views_actor",
|
||||
"crates/db_views_actor",
|
||||
"crates/db_migrations",
|
||||
"crates/routes"
|
||||
]
|
||||
|
||||
|
@ -60,7 +59,6 @@ lemmy_routes = { version = "=0.17.1", path = "./crates/routes" }
|
|||
lemmy_db_views = { version = "=0.17.1", path = "./crates/db_views" }
|
||||
lemmy_db_views_actor = { version = "=0.17.1", path = "./crates/db_views_actor" }
|
||||
lemmy_db_views_moderator = { version = "=0.17.1", path = "./crates/db_views_moderator" }
|
||||
lemmy_db_migrations = { version = "=0.17.1", path = "./crates/db_migrations" }
|
||||
activitypub_federation = { version = "0.4.0", default-features = false, features = ["actix-web"] }
|
||||
diesel = "2.1.0"
|
||||
diesel_migrations = "2.1.0"
|
||||
|
|
|
@ -68,7 +68,7 @@ impl PerformCrud for EditComment {
|
|||
|
||||
let comment_id = data.comment_id;
|
||||
let form = CommentUpdateForm::builder()
|
||||
.content(content_slurs_removed.map(std::borrow::Cow::into_owned))
|
||||
.content(content_slurs_removed.map(|s| s.into_owned()))
|
||||
.language_id(data.language_id)
|
||||
.updated(Some(Some(naive_now())))
|
||||
.build();
|
||||
|
|
|
@ -218,7 +218,7 @@ impl Object for ApubPost {
|
|||
PostInsertForm {
|
||||
name,
|
||||
url: url.map(Into::into),
|
||||
body: body_slurs_removed.map(std::borrow::Cow::into_owned),
|
||||
body: body_slurs_removed.map(|s| s.into_owned()),
|
||||
creator_id: creator.id,
|
||||
community_id: community.id,
|
||||
removed: None,
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
[package]
|
||||
name = "lemmy_db_migrations"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
description.workspace = true
|
||||
license.workspace = true
|
||||
homepage.workspace = true
|
||||
documentation.workspace = true
|
||||
repository.workspace = true
|
||||
|
||||
[lib]
|
||||
name = "lemmy_db_migrations"
|
||||
path = "src/lib.rs"
|
||||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
diesel_migrations = { workspace = true }
|
|
@ -1,9 +0,0 @@
|
|||
#![feature(trace_macros)]
|
||||
#[macro_use]
|
||||
extern crate diesel_migrations;
|
||||
|
||||
use diesel_migrations::EmbeddedMigrations;
|
||||
|
||||
trace_macros!(true);
|
||||
pub const MIGRATIONS: EmbeddedMigrations = embed_migrations!();
|
||||
trace_macros!(false);
|
|
@ -16,7 +16,7 @@ doctest = false
|
|||
[features]
|
||||
full = ["diesel", "diesel-derive-newtype", "diesel-derive-enum", "diesel_migrations", "bcrypt", "lemmy_utils",
|
||||
"activitypub_federation", "sha2", "regex", "once_cell", "serde_json", "diesel_ltree",
|
||||
"diesel-async", "deadpool", "ts-rs", "lemmy_db_migrations"]
|
||||
"diesel-async", "deadpool", "ts-rs"]
|
||||
|
||||
[dependencies]
|
||||
chrono = { workspace = true }
|
||||
|
@ -28,7 +28,6 @@ strum_macros = { workspace = true }
|
|||
serde_json = { workspace = true, optional = true }
|
||||
activitypub_federation = { workspace = true, optional = true }
|
||||
lemmy_utils = { workspace = true, optional = true }
|
||||
lemmy_db_migrations = { workspace = true, optional = true }
|
||||
bcrypt = { workspace = true, optional = true }
|
||||
diesel = { workspace = true, features = ["postgres","chrono", "serde_json"], optional = true }
|
||||
diesel-derive-newtype = { workspace = true, optional = true }
|
||||
|
|
|
@ -13,6 +13,7 @@ extern crate diesel_derive_enum;
|
|||
|
||||
// this is used in tests
|
||||
#[cfg(feature = "full")]
|
||||
#[macro_use]
|
||||
extern crate diesel_migrations;
|
||||
|
||||
#[cfg(feature = "full")]
|
||||
|
|
|
@ -24,7 +24,7 @@ use diesel_async::{
|
|||
AsyncDieselConnectionManager,
|
||||
},
|
||||
};
|
||||
use lemmy_db_migrations::MIGRATIONS;
|
||||
use diesel_migrations::EmbeddedMigrations;
|
||||
use lemmy_utils::{error::LemmyError, settings::structs::Settings};
|
||||
use once_cell::sync::Lazy;
|
||||
use regex::Regex;
|
||||
|
@ -153,6 +153,8 @@ async fn build_db_pool_settings_opt(settings: Option<&Settings>) -> Result<DbPoo
|
|||
Ok(pool)
|
||||
}
|
||||
|
||||
pub const MIGRATIONS: EmbeddedMigrations = embed_migrations!();
|
||||
|
||||
pub fn run_migrations(db_url: &str) {
|
||||
// Needs to be a sync connection
|
||||
let mut conn =
|
||||
|
|
Loading…
Reference in a new issue