|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
use Phinx\Migration\AbstractMigration; |
|
4
|
|
|
|
|
5
|
|
|
class Audit extends AbstractMigration |
|
6
|
|
|
{ |
|
7
|
|
|
/** |
|
8
|
|
|
* Create hash table 'users_data' |
|
9
|
|
|
*/ |
|
10
|
|
|
public function change() |
|
11
|
|
|
{ |
|
12
|
|
|
$users = $this->table('audit'); |
|
13
|
|
|
$users->addColumn('uuid', 'string', ['comment' => 'UUID', 'limit' => 36]) |
|
14
|
|
|
->addColumn('users_uuid', 'string', ['comment' => 'User UUID', 'limit' => 36, 'null' => true]) |
|
15
|
|
|
->addColumn('ip', 'string', ['comment' => 'IP-Address', 'limit' => 16, 'null' => true]) |
|
16
|
|
|
->addColumn('agent', 'string', ['comment' => 'User-Agent', 'limit' => 255, 'null' => true]) |
|
17
|
|
|
->addColumn('created', 'datetime', ['comment' => 'Created']) |
|
18
|
|
|
->addColumn('actor', 'string', ['comment' => 'Actor', 'limit' => 128, 'null' => true]) |
|
19
|
|
|
->addColumn('event', 'string', ['comment' => 'Event', 'limit' => 128, 'null' => true]) |
|
20
|
|
|
->addColumn('description', 'string', ['comment' => 'Description', 'limit' => 255, 'null' => true]) |
|
21
|
|
|
->addColumn('old', 'text', ['comment' => 'Old Value', 'null' => true]) |
|
22
|
|
|
->addColumn('new', 'text', ['comment' => 'New Value', 'null' => true]) |
|
23
|
|
|
->addColumn('debug', 'text', ['comment' => 'Debug Information', 'null' => true]) |
|
24
|
|
|
->addIndex(['uuid'], ['unique' => true]) |
|
25
|
|
|
->save(); |
|
26
|
|
|
} |
|
27
|
|
|
} |
|
28
|
|
|
|