You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 line
1.0KB

  1. <?php
  2. /**
  3. * This view is used by console/controllers/MigrateController.php
  4. * The following variables are available in this view:
  5. */
  6. /* @var $className string the new migration class name without namespace */
  7. /* @var $namespace string the new migration class namespace */
  8. /* @var $table string the name table */
  9. /* @var $fields array the fields */
  10. /* @var $foreignKeys array the foreign keys */
  11. echo "<?php\n";
  12. if (!empty($namespace)) {
  13. echo "\nnamespace {$namespace};\n";
  14. }
  15. ?>
  16. use yii\db\Migration;
  17. /**
  18. * Handles the creation of table `<?= $table ?>`.
  19. <?= $this->render('_foreignTables', [
  20. 'foreignKeys' => $foreignKeys,
  21. ]) ?>
  22. */
  23. class <?= $className ?> extends Migration
  24. {
  25. /**
  26. * @inheritdoc
  27. */
  28. public function up()
  29. {
  30. <?= $this->render('_createTable', [
  31. 'table' => $table,
  32. 'fields' => $fields,
  33. 'foreignKeys' => $foreignKeys,
  34. ])
  35. ?>
  36. }
  37. /**
  38. * @inheritdoc
  39. */
  40. public function down()
  41. {
  42. <?= $this->render('_dropTable', [
  43. 'table' => $table,
  44. 'foreignKeys' => $foreignKeys,
  45. ])
  46. ?>
  47. }
  48. }