Build a full-width CMS canvas and restore featured home products
This commit is contained in:
@@ -40,9 +40,13 @@ final class Database
|
||||
|
||||
self::write(function (PDO $pdo) use ($root, $seed): void {
|
||||
$pdo->exec(file_get_contents($root . '/resources/schema.sql'));
|
||||
if (!in_array('status', array_column($pdo->query('PRAGMA table_info(pages)')->fetchAll(), 'name'), true)) {
|
||||
$pageColumns = array_column($pdo->query('PRAGMA table_info(pages)')->fetchAll(), 'name');
|
||||
if (!in_array('status', $pageColumns, true)) {
|
||||
$pdo->exec("ALTER TABLE pages ADD COLUMN status TEXT NOT NULL DEFAULT 'published' CHECK (status IN ('draft', 'published'))");
|
||||
}
|
||||
if (!in_array('image_scale', $pageColumns, true)) {
|
||||
$pdo->exec('ALTER TABLE pages ADD COLUMN image_scale INTEGER NOT NULL DEFAULT 0');
|
||||
}
|
||||
$site = $pdo->prepare('INSERT OR IGNORE INTO site_settings (id, payload) VALUES (1, ?)');
|
||||
$site->execute([self::json($seed['site'])]);
|
||||
|
||||
@@ -92,6 +96,10 @@ final class Database
|
||||
if ($migration->rowCount() === 1) {
|
||||
DesignMigration::apply($pdo);
|
||||
}
|
||||
$migration->execute(['restore_home_featured_products']);
|
||||
if ($migration->rowCount() === 1) {
|
||||
DesignMigration::restoreFeaturedProducts($pdo, $seed);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user