chore: reorganize project into monorepo

This commit is contained in:
2026-03-28 10:40:22 +08:00
parent 60367a5f51
commit 1455d93246
201 changed files with 30081 additions and 93 deletions

View File

@@ -0,0 +1,46 @@
use sea_orm_migration::prelude::*;
use sea_orm_migration::sea_orm::DbBackend;
#[derive(DeriveMigrationName)]
pub struct Migration;
#[async_trait::async_trait]
impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
if manager.get_database_backend() != DbBackend::Postgres {
return Ok(());
}
manager
.get_connection()
.execute_unprepared(
r#"
CREATE INDEX IF NOT EXISTS idx_posts_search_fts
ON posts
USING GIN (
(
setweight(to_tsvector('simple', coalesce(title, '')), 'A') ||
setweight(to_tsvector('simple', coalesce(description, '')), 'B') ||
setweight(to_tsvector('simple', coalesce(category, '')), 'C') ||
setweight(to_tsvector('simple', coalesce(tags::text, '')), 'C') ||
setweight(to_tsvector('simple', coalesce(content, '')), 'D')
)
);
"#,
)
.await?;
Ok(())
}
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
if manager.get_database_backend() != DbBackend::Postgres {
return Ok(());
}
manager
.get_connection()
.execute_unprepared("DROP INDEX IF EXISTS idx_posts_search_fts;")
.await?;
Ok(())
}
}