refactor(db): use version string as primary key for ConfigVersion

-transition `of_config_versions` primary key from `id` to `version` string.
-add database migration files `202606270001_make_version_primary_key.sql` for PostgreSQL and SQLite.
-introduce AfterFind/AfterCreate GORM hooks to preserve JSON backward compatibility.
-refactor API controllers, logics, and front-end typescript definitions to receive `string` parameter.
This commit is contained in:
ryan
2026-06-27 13:38:02 +08:00
parent 13d6966cb5
commit ac7b776378
8 changed files with 11 additions and 87 deletions
@@ -129,7 +129,7 @@ func checksumAgentWAFIPGroup(group WAFIPGroup) string {
}
func activeConfigWAFIPGroupIDs(ctx context.Context) ([]uint, error) {
version, err := loadActiveConfigVersion(ctx)
version, err := model.GetActiveConfigVersion(ctx)
if err != nil {
if isActiveConfigNotFound(err) {
return []uint{}, nil