feat: 每站点独立版本号+总版本=SUM+规则变更同步所有同类型站点

This commit is contained in:
mediabot-pt
2026-07-05 22:06:11 +08:00
parent 8a2f6144a7
commit f493d52b5f
8 changed files with 23 additions and 16 deletions

View File

@@ -37,10 +37,7 @@ public class FlywayConfig {
"rules_json LONGTEXT NOT NULL, deleted TINYINT NOT NULL DEFAULT 0, " +
"created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, " +
"INDEX idx_site_type (site_type, deleted)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4");
stmt.execute("CREATE TABLE IF NOT EXISTS manifest_version (" +
"id INT PRIMARY KEY DEFAULT 1, version INT NOT NULL DEFAULT 1, updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP," +
"CHECK (id = 1)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4");
stmt.execute("INSERT IGNORE INTO manifest_version (id, version) VALUES (1, 1)");
try { stmt.execute("ALTER TABLE sites ADD COLUMN version INT NOT NULL DEFAULT 1"); } catch (Exception ex) { log.debug("version may exist"); }
log.info("V15 tables initialized");
} catch (Exception e) {
log.error("V15 migration failed: {}", e.getMessage());

View File

@@ -61,6 +61,7 @@ public class ManifestController {
entry.put("siteType", site.getSiteType() != null ? site.getSiteType().getValue() : null);
entry.put("schemaVersion", site.getSchemaVersion());
entry.put("status", site.getStatus() != null ? site.getStatus().getValue() : null);
entry.put("version", site.getVersion() != null ? site.getVersion() : 1);
SiteConfig latest = siteConfigMapper.selectLatestBySiteId(site.getSiteId());
if (latest != null) {