| 1234567891011121314151617181920212223242526272829 |
- <?php
- declare(strict_types=1);
- use App\Infrastructure\Db\Migrations\BaseMigration;
- final class CreateAuditLog extends BaseMigration
- {
- public function change(): void
- {
- $table = $this->table('audit_log');
- $table
- ->addColumn('actor_kind', 'string', ['limit' => 16, 'null' => false])
- ->addColumn('actor_id', 'string', ['limit' => 64, 'null' => true])
- ->addColumn('action', 'string', ['limit' => 64, 'null' => false])
- ->addColumn('target_type', 'string', ['limit' => 64, 'null' => true])
- ->addColumn('target_id', 'string', ['limit' => 64, 'null' => true])
- ->addColumn('details_json', 'text', ['null' => true])
- ->addColumn('ip_address', 'string', ['limit' => 45, 'null' => true]);
- $this->addTimestampColumn($table, 'created_at');
- $table
- ->addIndex(['created_at'])
- ->addIndex(['actor_kind', 'actor_id'])
- ->addIndex(['target_type', 'target_id'])
- ->create();
- }
- }
|