add migration
This commit is contained in:
@@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
use Phinx\Migration\AbstractMigration;
|
||||||
|
|
||||||
|
class AddPersonalInfoToDeliveryAddressAndOrder extends AbstractMigration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Change Method.
|
||||||
|
*
|
||||||
|
* Write your reversible migrations using this method.
|
||||||
|
*
|
||||||
|
* More information on writing migrations is available here:
|
||||||
|
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
|
||||||
|
*
|
||||||
|
* The following commands can be used in this method and Phinx will
|
||||||
|
* automatically reverse them when rolling back:
|
||||||
|
*
|
||||||
|
* createTable
|
||||||
|
* renameTable
|
||||||
|
* addColumn
|
||||||
|
* addCustomColumn
|
||||||
|
* renameColumn
|
||||||
|
* addIndex
|
||||||
|
* addForeignKey
|
||||||
|
*
|
||||||
|
* Any other distructive changes will result in an error when trying to
|
||||||
|
* rollback the migration.
|
||||||
|
*
|
||||||
|
* Remember to call "create()" or "update()" and NOT "save()" when working
|
||||||
|
* with the Table class.
|
||||||
|
*/
|
||||||
|
public function change()
|
||||||
|
{
|
||||||
|
$deliveryAddressesTable = $this->table('delivery_addresses');
|
||||||
|
$deliveryAddressesTable->addColumn('firstName', 'string', ['limit' => 100, 'null' => true, 'after'=>'idUser'])
|
||||||
|
->addColumn('lastName', 'string', ['limit'=>100, 'null'=> true, 'after'=>'firstName'])
|
||||||
|
->addColumn('deliveryMail', 'string', ['limit'=>300, 'null' => true, 'after'=>'lastName'])
|
||||||
|
->save();
|
||||||
|
|
||||||
|
$ordersTable = $this->table('orders');
|
||||||
|
$ordersTable->addColumn('deliveryFirstName', 'string', ['limit' => 100, 'null' => true, 'after'=>'deliveryAddress'])
|
||||||
|
->addColumn('deliveryLastName', 'string', ['limit'=>100, 'null'=> true, 'after'=>'deliveryFirstName'])
|
||||||
|
->addColumn('deliveryMail', 'string', ['limit'=>300, 'null' => true, 'after'=>'deliveryLastName'])
|
||||||
|
->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user