adding base db migrations.
This commit is contained in:
parent
3db175d542
commit
bf3d78da00
4 changed files with 134 additions and 0 deletions
36
app/migrations/20180321131740_create_callback_table.php
Normal file
36
app/migrations/20180321131740_create_callback_table.php
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
class CreateCallbackTable extends AbstractMigration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$table = $this->table('callback');
|
||||
$table->addColumn('public_id', 'string', [
|
||||
'length' => 12,
|
||||
'null' => false,
|
||||
])->addIndex('public_id', [ 'name' => 'UNIQUE_public_id', 'unique' => true ]);
|
||||
|
||||
$table->addColumn('userid', 'integer', [
|
||||
'null' => true,
|
||||
])->addForeignKey('userid', 'user', ['id'], [ 'constraint' => 'FK_user' ]);
|
||||
|
||||
$table->addColumn('name', 'string', [
|
||||
'length' => 64,
|
||||
'null' => false,
|
||||
]);
|
||||
|
||||
$table->addColumn('created_at', 'timestamp', [
|
||||
'default' => 'CURRENT_TIMESTAMP'
|
||||
]);
|
||||
|
||||
$table->addColumn('last_request', 'timestamp', [
|
||||
'default' => null,
|
||||
'null' => true
|
||||
]);
|
||||
|
||||
$table->save();
|
||||
}
|
||||
}
|
||||
Reference in a new issue