raspisms/db/migrations/20200305214357_add_id_user_...

23 lines
672 B
PHP
Raw Permalink Normal View History

2020-03-05 23:07:07 +01:00
<?php
use Phinx\Migration\AbstractMigration;
class AddIdUserSendedAndReceived extends AbstractMigration
{
/**
* Add id_user field in sended and received table
*/
public function change()
{
$this->table('received')
->addColumn('id_user', 'integer', ['null' => false])
->addForeignKey('id_user', 'user', 'id', ['delete'=> 'CASCADE', 'update'=> 'CASCADE'])
->save();
$this->table('sended')
->addColumn('id_user', 'integer', ['null' => false])
->addForeignKey('id_user', 'user', 'id', ['delete'=> 'CASCADE', 'update'=> 'CASCADE'])
->save();
}
}