|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
-
-
-
-
-
-
- preg_match('/^add_(.+)_columns?_to_(.+)_table$/', $name, $matches);
- $columns = $matches[1];
-
- echo "<?php\n";
- if (!empty($namespace)) {
- echo "\nnamespace {$namespace};\n";
- }
- ?>
-
- use yii\db\Migration;
-
-
- class <?= $className ?> extends Migration
- {
-
-
- public function up()
- {
- <?= $this->render('_addColumns', [
- 'table' => $table,
- 'fields' => $fields,
- 'foreignKeys' => $foreignKeys,
- ])
- ?>
- }
-
-
-
- public function down()
- {
- <?= $this->render('_dropColumns', [
- 'table' => $table,
- 'fields' => $fields,
- 'foreignKeys' => $foreignKeys,
- ])
- ?>
- }
- }
|