feat: Manifest全局版本号(站点/页面/规则/脚本任一变则递增)
This commit is contained in:
@@ -37,6 +37,10 @@ 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)");
|
||||
log.info("V15 tables initialized");
|
||||
} catch (Exception e) {
|
||||
log.error("V15 migration failed: {}", e.getMessage());
|
||||
|
||||
@@ -30,6 +30,7 @@ import java.util.stream.Collectors;
|
||||
@RequiredArgsConstructor
|
||||
public class ManifestController {
|
||||
|
||||
private final com.par.core.service.ManifestVersionService versionService;
|
||||
private final SiteMapper siteMapper;
|
||||
private final SiteConfigMapper siteConfigMapper;
|
||||
private final com.par.core.mapper.SitePagesMapper sitePagesMapper;
|
||||
@@ -88,7 +89,7 @@ public class ManifestController {
|
||||
}
|
||||
|
||||
Map<String, Object> manifest = new HashMap<>();
|
||||
manifest.put("version", "1.0");
|
||||
manifest.put("version", versionService.current());
|
||||
manifest.put("sites", entries);
|
||||
|
||||
return ResponseEntity.ok().eTag(etag).body(ApiResponse.success(manifest));
|
||||
|
||||
Reference in New Issue
Block a user