feat(migration) add migration

This commit is contained in:
lumither committed 2025-10-13 14:36:21 -04:00
1 parent 02e7166fcb
commit 3a4af1ae8d
9 files changed
+84 -22

No files matched your search

+14 -13
View File
@@ -1,16 +1,17 @@
use chrono::Utc;
use git2::Repository;
// use chrono::Utc;
// use git2::Repository;
fn main() {
let repo = Repository::open("../..").expect("failed to open repository");
let commit = repo
.head()
.expect("failed to get HEAD")
.peel_to_commit()
.expect("failed to get HEAD commit");
let hash = commit.id().to_string();
let utc_timestamp = Utc::now().date_naive().format("%Y%m%d").to_string();
let pkg_version = env!("CARGO_PKG_VERSION");
let build_id = format!("{}:{}@{}", pkg_version, &hash[..8], utc_timestamp);
println!("cargo:rustc-env=BUILD_ID={}", build_id);
// let repo = Repository::open("../..").expect("failed to open repository");
// let commit = repo
// .head()
// .expect("failed to get HEAD")
// .peel_to_commit()
// .expect("failed to get HEAD commit");
// let hash = commit.id().to_string();
// let utc_timestamp = Utc::now().date_naive().format("%Y%m%d").to_string();
// let pkg_version = env!("CARGO_PKG_VERSION");
// let build_id = format!("{}:{}@{}", pkg_version, &hash[..8], utc_timestamp);
// println!("cargo:rustc-env=BUILD_ID={}", build_id);
println!("cargo:rustc-env=BUILD_ID=undefined");
}