getTable('page'); // 'index' or 'noindex'. A page excluded here also disappears from the sitemap. $page->addColumn('robots', 'string', ['length' => 16, 'notnull' => true, 'default' => 'index']); $page->addColumn('og_media_id', 'string', ['length' => 32, 'notnull' => false]); // Company data, social profiles and switches, kept as one document per website. $schema->getTable('website')->addColumn('settings', 'json', ['notnull' => false]); $redirect = $schema->createTable('redirect'); $redirect->addColumn('id', 'string', ['length' => 64]); $redirect->addColumn('website_id', 'string', ['length' => 64]); // Stored without a leading slash, exactly like page.path, so both are comparable. $redirect->addColumn('from_path', 'string', ['length' => 400]); $redirect->addColumn('to_path', 'string', ['length' => 400, 'notnull' => false]); // 301 for a moved address, 410 for one that is deliberately gone. $redirect->addColumn('status', 'integer'); $redirect->addColumn('created_at', 'datetime_immutable'); $redirect->setPrimaryKey(['id']); $redirect->addUniqueIndex(['website_id', 'from_path'], 'uniq_redirect_from'); } public function down(Schema $schema): void { $this->throwIrreversibleMigrationException('Contains indexing settings, company data and redirects. Restore a verified database backup with matching code.'); } }