| Total Complexity | 2 | 
| Total Lines | 51 | 
| Duplicated Lines | 0 % | 
| Changes | 2 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php  | 
            ||
| 10 | class AddAuditsTable20220323095520 extends AbstractMigration  | 
            ||
| 11 | {
 | 
            ||
| 12 | public function up(): void  | 
            ||
| 13 |     {
 | 
            ||
| 14 | //Action when migrate up  | 
            ||
| 15 |         $this->create('audits', function (CreateTable $table) {
 | 
            ||
| 16 |             $table->integer('id')
 | 
            ||
| 17 | ->autoincrement()  | 
            ||
| 18 | ->primary();  | 
            ||
| 19 | |||
| 20 |             $table->string('event')
 | 
            ||
| 21 |                     ->description('The audit event')
 | 
            ||
| 22 | ->index()  | 
            ||
| 23 | ->notNull();  | 
            ||
| 24 | |||
| 25 |             $table->text('detail')
 | 
            ||
| 26 |                   ->description('The audit detail');
 | 
            ||
| 27 | |||
| 28 |             $table->string('url')
 | 
            ||
| 29 |                   ->description('The audit action URL');
 | 
            ||
| 30 | |||
| 31 |             $table->string('ip')
 | 
            ||
| 32 |                  ->description('The IP address')
 | 
            ||
| 33 | ->notNull();  | 
            ||
| 34 | |||
| 35 |             $table->string('user_agent')
 | 
            ||
| 36 |                   ->description('The user agent');
 | 
            ||
| 37 | |||
| 38 |             $table->string('tags')
 | 
            ||
| 39 |                   ->description('The audit tags');
 | 
            ||
| 40 | |||
| 41 |             $table->datetime('date')
 | 
            ||
| 42 |                     ->description('audit date')
 | 
            ||
| 43 | ->notNull();  | 
            ||
| 44 | |||
| 45 |             $table->integer('user_id')
 | 
            ||
| 46 |                     ->description('The audit user')
 | 
            ||
| 47 | ->notNull();  | 
            ||
| 48 | |||
| 49 |             $table->foreign('user_id')
 | 
            ||
| 50 |                     ->references('users', 'id')
 | 
            ||
| 51 |                     ->onDelete('NO ACTION');
 | 
            ||
| 52 | |||
| 53 |             $table->engine('INNODB');
 | 
            ||
| 54 | });  | 
            ||
| 55 | }  | 
            ||
| 56 | |||
| 57 | public function down(): void  | 
            ||
| 61 | }  | 
            ||
| 62 | }  | 
            ||
| 63 |