Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

56 lines
1.3KB

  1. <?php
  2. namespace App\Util;
  3. use Exception;
  4. use Illuminate\Database\Migrations\Migration;
  5. use Nette\NotImplementedException;
  6. abstract class MigrationEx extends Migration
  7. {
  8. public function up(): void
  9. {
  10. if (!$this->connection) {
  11. throw new Exception("connection 未定義");
  12. }
  13. // 共通スキーマの変更は社内テスト(520)の場合のみ行う
  14. if ($this->connection === "htpms") {
  15. if (config("database.connections.htpms_customer.database") !== "htpms_520") {
  16. printf("htpms スキップ\n");
  17. return;
  18. }
  19. }
  20. $this->runUp();
  21. }
  22. public function down(): void
  23. {
  24. if (!$this->connection) {
  25. throw new Exception("connection 未定義");
  26. }
  27. // 共通スキーマの変更は社内テスト(520)の場合のみ行う
  28. if ($this->connection === "htpms") {
  29. if (config("database.connections.htpms_customer.database") !== "htpms_520") {
  30. printf("htpms スキップ\n");
  31. return;
  32. }
  33. }
  34. $this->runDown();
  35. }
  36. protected function runUp(): void
  37. {
  38. throw new NotImplementedException();
  39. }
  40. protected function runDown(): void
  41. {
  42. throw new NotImplementedException();
  43. }
  44. };