Add page publication history and reusable blocks

This commit is contained in:
2026-11-28 18:12:30 +08:00
parent 1c927d360c
commit 3b13f6533d
40 changed files with 1239 additions and 165 deletions
+5 -1
View File
@@ -12,7 +12,7 @@ use Throwable;
final class Database
{
public const MIGRATION_REQUIRED = '数据库尚未完成升级。请在站点目录运行 php bin/install.php。';
private const SCHEMA_VERSION = 9;
private const SCHEMA_VERSION = 10;
// Avoid reusing a deleted ID that may still be open in an editing form.
public const NEXT_ARTICLE_ID = 'MAX(COALESCE((SELECT MAX(id) FROM articles), 0),
COALESCE((SELECT MAX(article_id) FROM article_deletions), 0)) + 1';
@@ -106,6 +106,10 @@ final class Database
self::migratePageRoutes($pdo, $schema);
DesignLibrary::ensureDefaultPalette($pdo);
}
$pdo->exec(file_get_contents($root . '/resources/page-revisions.sql'));
if ($version < 10) {
PageRevisions::seed($pdo);
}
if ($version < self::SCHEMA_VERSION) {
$pdo->exec('PRAGMA user_version = ' . self::SCHEMA_VERSION);
}