Initial commit

This commit is contained in:
2025-07-22 20:41:13 -06:00
commit 91918b6403
18 changed files with 2753 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
use seamantic::schema::{sqlite_case_insensitive_string, sqlite_rowid_alias};
use sea_orm_migration::prelude::*;
#[derive(Iden)]
pub(super) enum Objects {
Table,
Id,
Name,
}
#[derive(DeriveMigrationName)]
pub(super) struct Migration;
#[async_trait::async_trait]
impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager
.create_table(
Table::create()
.table(Objects::Table)
.col(sqlite_rowid_alias(Objects::Id))
.col(sqlite_case_insensitive_string(Objects::Name))
.to_owned(),
)
.await?;
Ok(())
}
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager
.drop_table(Table::drop().table(Objects::Table).to_owned())
.await?;
Ok(())
}
}
+17
View File
@@ -0,0 +1,17 @@
//! This example shows how to use `seamantic::migrations!` and how to
//! make a migration with the sqlite schema helpers
use sea_orm::{ConnectOptions, Database};
use sea_orm_migration::MigratorTrait;
seamantic::migrations! {
"seaql_migrations_test";
m_01,
}
#[tokio::main(flavor = "current_thread")]
async fn main() {
let options = ConnectOptions::new("sqlite:/tmp/db?mode=memory");
let database = Database::connect(options).await.expect("Database::connect");
Migrator::up(&database, None).await.expect("Migrator::up");
}