|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <?php
- /**
- * This view is used by console/controllers/MigrateController.php
- * The following variables are available in this view:
- */
- /* @var $className string the new migration class name */
- /* @var $table string the name table */
- /* @var $fields array the fields */
- preg_match('/^drop_(.+)_columns?_from_(.+)_table$/', $name, $matches);
- $columns = $matches[1];
-
- echo "<?php\n";
- ?>
-
- use yii\db\Migration;
-
- /**
- * Handles dropping <?= $columns ?> from table `<?= $table ?>`.
- <?= $this->render('_foreignTables', [
- 'foreignKeys' => $foreignKeys,
- ]) ?>
- */
- class <?= $className ?> extends Migration
- {
- /**
- * @inheritdoc
- */
- public function up()
- {
- <?= $this->render('_dropColumns', [
- 'table' => $table,
- 'fields' => $fields,
- 'foreignKeys' => $foreignKeys,
- ])
- ?>
- }
-
- /**
- * @inheritdoc
- */
- public function down()
- {
- <?= $this->render('_addColumns', [
- 'table' => $table,
- 'fields' => $fields,
- 'foreignKeys' => $foreignKeys,
- ])
- ?>
- }
- }
|