mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
#### PR Dependency Tree * **PR #14243** 👈 This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Batch management API for coordinated document mutations and change tracking. * New document accessors (IDs, state snapshots, change/delete set queries) and subscriber count. * **Chores** * Upgraded Rust edition across packages to 2024. * Repository-wide formatting, stylistic cleanups and test adjustments. * **Breaking Changes** * Removed the Node native bindings package and its JS/TS declarations and tests (no longer published/available). <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
34 lines
880 B
Rust
34 lines
880 B
Rust
use std::fs;
|
|
|
|
use sqlx::sqlite::SqliteConnectOptions;
|
|
|
|
#[tokio::main]
|
|
async fn main() -> Result<(), std::io::Error> {
|
|
napi_build::setup();
|
|
|
|
// always start with a fresh database to have latest db schema
|
|
let cwd = std::env::var("CARGO_MANIFEST_DIR").unwrap();
|
|
let db_path = format!("{cwd}/affine.db");
|
|
|
|
if fs::metadata(&db_path).is_ok() {
|
|
fs::remove_file(&db_path)?;
|
|
}
|
|
|
|
let options = SqliteConnectOptions::new()
|
|
.filename(&db_path)
|
|
.journal_mode(sqlx::sqlite::SqliteJournalMode::Off)
|
|
.locking_mode(sqlx::sqlite::SqliteLockingMode::Exclusive)
|
|
.create_if_missing(true);
|
|
let pool = sqlx::sqlite::SqlitePoolOptions::new()
|
|
.max_connections(1)
|
|
.connect_with(options)
|
|
.await
|
|
.unwrap();
|
|
|
|
sqlx::query(affine_schema::v1::SCHEMA).execute(&pool).await.unwrap();
|
|
|
|
println!("cargo::rustc-env=DATABASE_URL=sqlite://{db_path}");
|
|
|
|
Ok(())
|
|
}
|