new network model and mfBaseModelV2

This commit is contained in:
2025-12-14 22:15:00 +01:00
parent 12a7598447
commit b4961fd423
12 changed files with 1944 additions and 335 deletions

View File

@@ -0,0 +1,34 @@
<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class CreateJournalTable extends AbstractMigration
{
public function up(): void
{
if ($this->getEnvironment() == "thetool") {
$this->table('Journal')
->addColumn('user_id', 'integer', ['null' => true, 'signed' => false])
->addColumn('model', 'string', ['limit' => 255, 'null' => false])
->addColumn('record_id', 'integer', ['null' => false])
->addColumn('action', 'enum', ['values' => ['create', 'update', 'delete'], 'null' => false])
->addColumn('field', 'string', ['limit' => 255, 'null' => true])
->addColumn('old_value', 'text', ['null' => true])
->addColumn('new_value', 'text', ['null' => true])
->addColumn('timestamp', 'timestamp', ['default' => 'CURRENT_TIMESTAMP'])
->addIndex(['model', 'record_id'], ['name' => 'idx_model_record'])
->addIndex(['user_id'], ['name' => 'idx_user'])
->addIndex(['action'], ['name' => 'idx_action'])
->addIndex(['timestamp'], ['name' => 'idx_timestamp'])
->create();
}
}
public function down(): void
{
if ($this->getEnvironment() == "thetool") {
$this->table('Journal')->drop()->save();
}
}
}