+
Skip to content

Issue 2610 reproducible example #2611

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions issues/2610/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[package]
name = "sea-orm-issues-2610"
version = "0.1.0"
edition = "2024"

[lib]
name = "migration"
path = "src/lib.rs"

[dependencies]
async-std = { version = "1", features = ["attributes", "tokio1"] }
sea-orm-migration = { version = "1.1.12", features = [
"runtime-tokio-rustls",
"sqlx-postgres",
] }
14 changes: 14 additions & 0 deletions issues/2610/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
pub use sea_orm_migration::prelude::*;

mod m20220101_000001_init;

pub struct Migrator;

#[async_trait::async_trait]
impl MigratorTrait for Migrator {
fn migrations() -> Vec<Box<dyn MigrationTrait>> {
vec![
Box::new(m20220101_000001_init::Migration),
]
}
}
31 changes: 31 additions & 0 deletions issues/2610/src/m20220101_000001_init.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
use sea_orm_migration::prelude::*;

#[derive(DeriveMigrationName)]
pub struct Migration;

#[async_trait::async_trait]
impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
let db = manager.get_connection();

db.execute_unprepared(
"--sql
CREATE EXTENSION IF NOT EXISTS pg_trgm",
)
.await?;

Ok(())
}

async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
let db = manager.get_connection();

db.execute_unprepared(
"--sql
DROP EXTENSION IF EXISTS pg_trgm",
)
.await?;

Ok(())
}
}
6 changes: 6 additions & 0 deletions issues/2610/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
use sea_orm_migration::prelude::*;

#[async_std::main]
async fn main() {
cli::run_cli(migration::Migrator).await;
}
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载