Edit shared headers and footers as page types

This commit is contained in:
2026-11-23 20:58:42 +08:00
parent 636788b65c
commit 9d386dd39c
40 changed files with 725 additions and 937 deletions
+9 -1
View File
@@ -11,7 +11,7 @@ use Throwable;
final class Database
{
private const SCHEMA_VERSION = 3;
private const SCHEMA_VERSION = 4;
// 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';
@@ -82,6 +82,14 @@ final class Database
if ($version < 2) {
OAuthCredentials::migrateLegacy($pdo);
}
if ($version < 4) {
$columns = $pdo->query('PRAGMA table_info(pages)')->fetchAll();
if (!in_array('layout_id', array_column($columns, 'name'), true)) {
$pdo->exec('ALTER TABLE pages ADD COLUMN layout_id INTEGER REFERENCES design_presets(id)');
}
$pdo->exec('CREATE UNIQUE INDEX IF NOT EXISTS pages_layout_id ON pages(layout_id)');
LayoutPage::migrate($pdo);
}
if ($version < self::SCHEMA_VERSION) {
$pdo->exec('PRAGMA user_version = ' . self::SCHEMA_VERSION);
}