SiteWeaver_CMS/database/migrations/20260906030000_pages_add_builder_columns.php

41 lines
1.4 KiB
PHP
Raw Normal View History

<?php
/**
* 20260906030000_pages_add_builder_columns.php
*
* Author: Funky Waddle
* Date: 2026-09-06
*
* Purpose: Additive migration for the Page Builder screen (`ui.notes` ->
* "Page Builder" in APP.yaml), which needs to store the "Include in Site
* Navigation" checkbox and the custom-content-vs-plugin-output dropdown
* choice. Does not alter any existing column on `pages`.
*/
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class PagesAddBuilderColumns extends AbstractMigration
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change(): void
{
$table = $this->table('pages');
$table->addColumn('include_in_nav', 'boolean', ['null' => false, 'default' => false])
->addColumn('content_type', 'string', ['limit' => 20, 'null' => false, 'default' => 'content', 'comment' => "'content' (WYSIWYG-authored) or 'plugin' (rendered by a plugin's output)"])
->addColumn('plugin_slug', 'string', ['limit' => 255, 'null' => true, 'comment' => 'which active plugin provides the output, when content_type=plugin'])
->update();
}
}