3 use Phinx\Migration\AbstractMigration;
5 class DropLocationCategoriesTable extends AbstractMigration
10 * Write your reversible migrations using this method.
12 * More information on writing migrations is available here:
13 * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
15 * The following commands can be used in this method and Phinx will
16 * automatically reverse them when rolling back:
25 * Remember to call "create()" or "update()" and NOT "save()" when working
26 * with the Table class.
28 # public function change()
34 $this->table('locations_categories')
38 public function down()
40 $this->table('locations_categories', ['id' => false, 'primary_key' => ['id']])
41 ->addColumn('id', 'integer', ['identity' => true, 'signed' => false])
42 ->addColumn('location_id', 'integer', ['signed' => false])
43 ->addColumn('category_id', 'integer', ['signed' => false])
44 ->addColumn('created', 'datetime')
45 ->addColumn('modified', 'datetime')
46 ->addForeignKey('location_id', 'locations', 'id')
47 //not nullable, array('delete'=> 'SET_NULL', 'update'=> 'NO_ACTION')
48 ->addForeignKey('category_id', 'categories', 'id')