Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

dropTableMigration.php 1015B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. echo "<?php\n";
  11. if (!empty($namespace)) {
  12. echo "\nnamespace {$namespace};\n";
  13. }
  14. ?>
  15. use yii\db\Migration;
  16. /**
  17. * Handles the dropping of table `<?= $table ?>`.
  18. <?= $this->render('_foreignTables', [
  19. 'foreignKeys' => $foreignKeys,
  20. ]) ?>
  21. */
  22. class <?= $className ?> extends Migration
  23. {
  24. /**
  25. * @inheritdoc
  26. */
  27. public function up()
  28. {
  29. <?= $this->render('_dropTable', [
  30. 'table' => $table,
  31. 'foreignKeys' => $foreignKeys,
  32. ])
  33. ?>
  34. }
  35. /**
  36. * @inheritdoc
  37. */
  38. public function down()
  39. {
  40. <?= $this->render('_createTable', [
  41. 'table' => $table,
  42. 'fields' => $fields,
  43. 'foreignKeys' => $foreignKeys,
  44. ])
  45. ?>
  46. }
  47. }