feat: Add Dockerfile for containerization and implement database migrations for both SQLite and Postgres.

This commit is contained in:
2026-01-02 05:56:33 +01:00
parent c1c42f4fd9
commit d916218703
2 changed files with 32 additions and 7 deletions

View File

@@ -2,17 +2,15 @@ pub use k_core::db::{DatabaseConfig, DatabasePool};
pub async fn run_migrations(pool: &DatabasePool) -> Result<(), sqlx::Error> {
match pool {
#[cfg(feature = "sqlite")]
DatabasePool::Sqlite(pool) => {
// Point specifically to the sqlite folder
sqlx::migrate!("../migrations_sqlite").run(pool).await?;
}
#[cfg(feature = "postgres")]
DatabasePool::Postgres(_) => {
// Postgres migrations would go here
tracing::warn!("Postgres migrations not implemented in template yet");
// Pass through the types from the core library
// This allows you to change k-core later without breaking imports in template-infra
// The `pub use` statement cannot be placed inside a match arm.
// It is already present at the top of the file.
DatabasePool::Postgres(pool) => {
// Point specifically to the postgres folder
sqlx::migrate!("../migrations_postgres").run(pool).await?;
}
}
Ok(())