mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 09:20:22 +08:00
refactor(data): baseline 迁移改为完整幂等建库脚本,放宽 checksum 校验
- baseline migration 从占位 SELECT 1 替换为完整的幂等 DDL,支持全新数据库从零建库 - 迁移校验从 checksum 严格报错改为 warn-only,仅按版本匹配 - 移除过时的 schema 导出文件(README/TSV) - Dockerfile 移除 :nonroot 标签,docker-compose 移除 user 指令,统一以默认用户运行
This commit is contained in:
@@ -137,6 +137,11 @@ fn validate_applied_migrations(
|
||||
}
|
||||
}
|
||||
|
||||
// Checksum drift is reported as a warning only. Strict enforcement makes
|
||||
// harmless edits (comment tweaks, whitespace, metadata fixes) impossible
|
||||
// without also touching every environment's migration history table. We
|
||||
// match by version alone — sqlx still skips already-applied migrations so
|
||||
// edited files will not re-run, they are merely allowed to exist.
|
||||
for migration in MIGRATOR
|
||||
.iter()
|
||||
.filter(|migration| migration.migration_type.is_up_migration())
|
||||
@@ -146,12 +151,11 @@ fn validate_applied_migrations(
|
||||
.find(|applied_migration| applied_migration.version == migration.version)
|
||||
{
|
||||
if migration.checksum != applied_migration.checksum {
|
||||
error!(
|
||||
warn!(
|
||||
version = migration.version,
|
||||
description = %migration.description,
|
||||
"database migration checksum mismatch detected"
|
||||
"database migration checksum mismatch (ignored: version-only validation)"
|
||||
);
|
||||
return Err(MigrateError::VersionMismatch(migration.version));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user