PDFs go through the same upload field as images, are checked by their content and kept unchanged in their own table. Every link field can pick one, and a page that links a PDF opens it in a dialog with the browser's own viewer; touch devices and browsers without a viewer get a new tab instead. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
40 lines
1.3 KiB
PHP
40 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace DoctrineMigrations;
|
|
|
|
use Doctrine\DBAL\Schema\Schema;
|
|
use Doctrine\Migrations\AbstractMigration;
|
|
|
|
final class Version20260917000100 extends AbstractMigration
|
|
{
|
|
public function getDescription(): string
|
|
{
|
|
return 'Dokumente: PDFs in der Mediathek, zum Verlinken und fuer den Betrachter.';
|
|
}
|
|
|
|
public function isTransactional(): bool
|
|
{
|
|
return false;
|
|
}
|
|
|
|
public function up(Schema $schema): void
|
|
{
|
|
// Eine eigene Tabelle statt einer Art-Spalte in media: jede Stelle, die ein Bild sucht,
|
|
// erwartet Varianten mit Breite und Hoehe. Ein PDF dort waere ein Bild ohne Bild - an
|
|
// einem Dutzend Stellen. Getrennt kann keine Bildauswahl je ein Dokument finden.
|
|
$document = $schema->createTable('document');
|
|
$document->addColumn('id', 'string', ['length' => 32]);
|
|
$document->addColumn('title', 'string', ['length' => 160]);
|
|
$document->addColumn('bytes', 'integer');
|
|
$document->addColumn('archived', 'boolean', ['default' => false]);
|
|
$document->addColumn('version', 'integer', ['default' => 1]);
|
|
$document->addColumn('created_at', 'datetime_immutable');
|
|
$document->setPrimaryKey(['id']);
|
|
}
|
|
|
|
public function down(Schema $schema): void
|
|
{
|
|
$schema->dropTable('document');
|
|
}
|
|
}
|