Kant CMS: Grundgerüst, visueller Editor, Mediathek
Symfony 7.4 / Twig / Doctrine DBAL auf herkömmlichem PHP-Webhosting. Versionierte Blockdokumente (v1-v3) mit unveränderlichen Revisionen, getrennten Entwürfen/Veröffentlichungen und optimistischer Konflikterkennung. Visueller Editor mit Strukturbaum, Live-Vorschau, responsiven Gerätewerten, Abschnittsvorlagen, Bildmediathek, Galerien und Effekten. Öffentliche Ausgabe ohne Editor-JavaScript. Geprüft: 41 PHP-Tests / 155 Assertions, 10 JavaScript-Modelltests. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
commit
82b07820bc
87 files changed
+14463
No files matched your search
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
final class Version20260912000100 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Website, localized pages and immutable document revisions (schema v1).';
|
||||
}
|
||||
|
||||
public function isTransactional(): bool
|
||||
{
|
||||
return false; // MySQL DDL commits implicitly. Backup before production migrations.
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$site = $schema->createTable('website');
|
||||
$site->addColumn('id', 'string', ['length' => 64]);
|
||||
$site->addColumn('name', 'string', ['length' => 200]);
|
||||
$site->addColumn('default_locale', 'string', ['length' => 12]);
|
||||
$site->addColumn('theme', 'json');
|
||||
$site->setPrimaryKey(['id']);
|
||||
|
||||
$page = $schema->createTable('page');
|
||||
$page->addColumn('id', 'string', ['length' => 64]);
|
||||
$page->addColumn('website_id', 'string', ['length' => 64]);
|
||||
$page->addColumn('slug', 'string', ['length' => 160]);
|
||||
$page->addColumn('locale', 'string', ['length' => 12]);
|
||||
$page->addColumn('draft_revision_id', 'string', ['length' => 64, 'notnull' => false]);
|
||||
$page->addColumn('published_revision_id', 'string', ['length' => 64, 'notnull' => false]);
|
||||
$page->addColumn('version', 'integer', ['default' => 0]);
|
||||
$page->setPrimaryKey(['id']);
|
||||
$page->addUniqueIndex(['website_id', 'locale', 'slug']);
|
||||
$page->addForeignKeyConstraint('website', ['website_id'], ['id']);
|
||||
|
||||
$revision = $schema->createTable('revision');
|
||||
$revision->addColumn('id', 'string', ['length' => 64]);
|
||||
$revision->addColumn('page_id', 'string', ['length' => 64]);
|
||||
$revision->addColumn('document', 'json');
|
||||
$revision->addColumn('created_at', 'datetime_immutable');
|
||||
$revision->setPrimaryKey(['id']);
|
||||
$revision->addForeignKeyConstraint('page', ['page_id'], ['id']);
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->throwIrreversibleMigrationException('Contains customer content. Restore a verified database backup and matching code.');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
final class Version20260912000200 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Add CMS users without changing existing pages or revisions.';
|
||||
}
|
||||
|
||||
public function isTransactional(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$users = $schema->createTable('cms_user');
|
||||
$users->addColumn('id', 'string', ['length' => 64]);
|
||||
$users->addColumn('username', 'string', ['length' => 100]);
|
||||
$users->addColumn('password_hash', 'string', ['length' => 255]);
|
||||
$users->addColumn('roles', 'json');
|
||||
$users->setPrimaryKey(['id']);
|
||||
$users->addUniqueIndex(['username']);
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->throwIrreversibleMigrationException('Contains account data. Restore the verified database backup with matching code.');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
final class Version20260912000300 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Add image library with immutable image variants and reversible archiving.';
|
||||
}
|
||||
|
||||
public function isTransactional(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$media = $schema->createTable('media');
|
||||
$media->addColumn('id', 'string', ['length' => 32]);
|
||||
$media->addColumn('title', 'string', ['length' => 160]);
|
||||
$media->addColumn('alt', 'string', ['length' => 300]);
|
||||
$media->addColumn('variants', 'json');
|
||||
$media->addColumn('archived', 'boolean', ['default' => false]);
|
||||
$media->addColumn('version', 'integer', ['default' => 1]);
|
||||
$media->addColumn('created_at', 'datetime_immutable');
|
||||
$media->setPrimaryKey(['id']);
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->throwIrreversibleMigrationException('Restore database and media files together from a verified backup.');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user