mirror of
https://github.com/RaspbianFrance/raspisms.git
synced 2025-06-07 07:06:26 +02:00
Update phone to use name instead of number and update sended to use phone id instead of origin
This commit is contained in:
parent
62c7f69395
commit
d5be760843
12 changed files with 91 additions and 93 deletions
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
class UpdatePhoneToReplaceNumber extends AbstractMigration
|
||||
{
|
||||
public function change()
|
||||
{
|
||||
|
||||
$table = $this->table('phone');
|
||||
$table->removeColumn('number');
|
||||
$table->addColumn('name', 'string', ['null' => false, 'limit' => 150]);
|
||||
$table->addIndex('name', ['unique' => true]);
|
||||
$table->update();
|
||||
|
||||
$table = $this->table('sended');
|
||||
$table->removeColumn('origin');
|
||||
$table->addColumn('id_phone', 'integer', ['null' => true]);
|
||||
$table->addForeignKey('id_phone', 'phone', 'id', ['delete' => 'SET_NULL', 'update' => 'CASCADE']);
|
||||
$table->update();
|
||||
|
||||
|
||||
$table = $this->table('received');
|
||||
$table->removeColumn('destination');
|
||||
$table->addColumn('id_phone', 'integer', ['null' => true]);
|
||||
$table->addForeignKey('id_phone', 'phone', 'id', ['delete' => 'SET_NULL', 'update' => 'CASCADE']);
|
||||
$table->update();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue