Skip to content

Commit

Permalink
Merge branch 'main' into feat-chat-sync-jupyter-notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
icycodes authored Dec 28, 2024
2 parents 9645eda + fcb1783 commit 8b44020
Show file tree
Hide file tree
Showing 41 changed files with 1,164 additions and 314 deletions.
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
15 changes: 2 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -345,23 +345,12 @@ jobs:
- name: Display structure of created files
run: ls -R dist

- name: Determine is stable release
run: |
if [[ ${{ github.ref_name }} =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "STABLE_RELEASE=true" >> $GITHUB_ENV
else
echo "STABLE_RELEASE=false" >> $GITHUB_ENV
fi
- name: Check if stable release
run: echo "Stable Release is ${{ env.STABLE_RELEASE }}"

- uses: ncipollo/release-action@v1
if: github.event_name == 'push'
with:
allowUpdates: true
prerelease: ${{ env.STABLE_RELEASE == 'false' }}
makeLatest: ${{ env.STABLE_RELEASE == 'true' }}
prerelease: true
makeLatest: false
artifacts: "dist/tabby_*.zip,dist/tabby_*.tar.gz"
tag: ${{ github.ref_name }}
removeArtifacts: true
100 changes: 94 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ members = [
"crates/llama-cpp-server",
"crates/ollama-api-bindings",
"crates/tabby-index-cli",
"crates/hash-ids",
"crates/sqlx-migrate-validate",

"ee/tabby-webserver",
"ee/tabby-db",
"ee/tabby-db-macros",
"ee/tabby-schema",
"crates/hash-ids",
]

[workspace.package]
Expand Down Expand Up @@ -76,6 +77,8 @@ opentelemetry = { version = "0.27.0", features = ["trace", "metrics"] }
opentelemetry_sdk = { version = "0.27.0", default-features = false, features = ["trace", "rt-tokio"] }
opentelemetry-otlp = { version = "0.27.0" }
opentelemetry-semantic-conventions = { version = "0.27.0", features = ["semconv_experimental"] }
# https://github.com/wsxiaoys/sqlx/tree/fix-0-7-4-remove-datetime-utc-encode
sqlx = { git = "https://github.com/wsxiaoys/sqlx", rev = "8ca573c" }

[workspace.dependencies.uuid]
version = "1.3.3"
Expand Down
16 changes: 16 additions & 0 deletions crates/sqlx-migrate-validate/Cargo.toml
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" ] }
3 changes: 3 additions & 0 deletions crates/sqlx-migrate-validate/README.md
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
11 changes: 11 additions & 0 deletions crates/sqlx-migrate-validate/src/error.rs
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),
}
36 changes: 36 additions & 0 deletions crates/sqlx-migrate-validate/src/lib.rs
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;
Loading

0 comments on commit 8b44020

Please sign in to comment.