-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat-chat-sync-jupyter-notebook
- Loading branch information
Showing
41 changed files
with
1,164 additions
and
314 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
.changes/unreleased/Fixed and Improvements-20241226-202337.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
kind: Fixed and Improvements | ||
body: Backup database only when there's pending schema migrations | ||
time: 2024-12-26T20:23:37.914517+08:00 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[package] | ||
name = "sqlx-migrate-validate" | ||
version.workspace = true | ||
edition.workspace = true | ||
authors.workspace = true | ||
homepage.workspace = true | ||
|
||
[dependencies] | ||
thiserror.workspace = true | ||
async-trait.workspace = true | ||
sqlx = { workspace = true, features = ["sqlite", "runtime-tokio"] } | ||
|
||
[dev-dependencies] | ||
anyhow.workspace = true | ||
tokio = { workspace = true, features = ["macros", "rt"] } | ||
sqlx-rt = { version = "0.6", features = [ "runtime-tokio-rustls" ] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# sqlx-migrate-validate | ||
|
||
Vendored fork of https://github.com/tobikris/sqlx-migrate-validate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
use sqlx::migrate::MigrateError; | ||
|
||
#[derive(Debug, thiserror::Error)] | ||
#[non_exhaustive] | ||
pub enum ValidateError { | ||
#[error("migration {0} was not applied")] | ||
VersionNotApplied(i64), | ||
|
||
#[error(transparent)] | ||
MigrateError(#[from] MigrateError), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
//! With [sqlx] and its [sqlx::migrate!] macro it is possible to create migrations and apply them to a database. | ||
//! When starting an application it is important to validate that the database is in the correct state. | ||
//! This crate provides a way to validate that the applied migrations match the desired migrations. | ||
//! In combination with the [sqlx::migrate!] macro it is possible to validate that the database schema | ||
//! matches the migrations present in the source code at the time of compilation. | ||
//! | ||
//! While this does not ensure full compatibility between the database and the application it can help | ||
//! to detect issues early. | ||
//! | ||
//! Examples: | ||
//! | ||
//! ```rust,no_run | ||
//! use sqlx_migrate_validate::{Validate, Validator}; | ||
//! | ||
//! #[tokio::main] | ||
//! async fn main() -> Result<(), anyhow::Error> { | ||
//! let pool = sqlx::SqlitePool::connect("sqlite::memory:").await?; | ||
//! let mut conn = pool.acquire().await?; | ||
//! | ||
//! sqlx::migrate!("./tests/migrations-1") | ||
//! .validate(&mut *conn) | ||
//! .await?; | ||
//! | ||
//! Ok(()) | ||
//! } | ||
//! ``` | ||
mod error; | ||
mod validate; | ||
|
||
pub use error::ValidateError; | ||
pub use validate::*; | ||
|
||
#[doc = include_str!("../README.md")] | ||
#[cfg(doctest)] | ||
pub struct ReadmeDoctests; |
Oops, something went wrong.