DB Migration: 20180401083402_create_activity_log.php
This commit is contained in:
parent
2b6da6453b
commit
05095a9c8e
1 changed files with 32 additions and 0 deletions
32
app/migrations/20180401083402_create_activity_log.php
Normal file
32
app/migrations/20180401083402_create_activity_log.php
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
class CreateActivityLog extends AbstractMigration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$table = $this->table('activity_log');
|
||||
|
||||
$table->addColumn('timestamp', 'datetime', [
|
||||
'default' => 'CURRENT_TIMESTAMP',
|
||||
'after' => 'email'
|
||||
]);
|
||||
|
||||
$table->addColumn('user_id', 'integer')
|
||||
->addForeignKey('user_id', 'user', ['id']);
|
||||
|
||||
$table->addColumn('ip', 'string', [
|
||||
'null' => true,
|
||||
'length' => 50,
|
||||
]);
|
||||
|
||||
$table->addColumn('message', 'string', [
|
||||
'null' => true,
|
||||
'length' => 255,
|
||||
]);
|
||||
|
||||
$table->save();
|
||||
}
|
||||
}
|
||||
Reference in a new issue