added files for mescole

This commit is contained in:
2026-07-03 09:28:21 +02:00
parent c675eb766e
commit 376252e263
10 changed files with 955 additions and 20 deletions
@@ -0,0 +1,60 @@
<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class CreateMescoleFilesTable extends AbstractMigration
{
public function change(): void
{
$table = $this->table('mescole_files', [
'id' => 'id',
'signed' => true,
'engine' => 'InnoDB',
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
]);
$table
->addColumn('idmescola', 'integer', [
'signed' => true,
'null' => false,
])
->addColumn('categoria', 'string', [
'limit' => 100,
'null' => false,
'comment' => 'slug categoria: schede_tecniche, certificati_analisi, ...',
])
->addColumn('titolo', 'string', [
'limit' => 255,
'null' => false,
])
->addColumn('filename', 'string', [
'limit' => 255,
'null' => false,
'comment' => 'nome fisico del file salvato su disco (random, non l\'originale)',
])
->addColumn('original_filename', 'string', [
'limit' => 255,
'null' => false,
])
->addColumn('mime_type', 'string', [
'limit' => 150,
'null' => true,
])
->addColumn('filesize', 'integer', [
'null' => true,
])
->addColumn('uploaded_at', 'datetime', [
'default' => 'CURRENT_TIMESTAMP',
])
->addIndex(['idmescola'])
->addIndex(['categoria'])
->addForeignKey('idmescola', 'mescole', 'id', [
'delete' => 'CASCADE',
'update' => 'CASCADE',
])
->create();
}
}