| @@ 27-41 (lines=15) @@ | ||
| 24 | 'user_chat', |
|
| 25 | ]; |
|
| 26 | ||
| 27 | public function up(): void |
|
| 28 | { |
|
| 29 | foreach ($this->tables as $table) { |
|
| 30 | try { |
|
| 31 | if (Schema::hasTable($this->prefix . $table)) { |
|
| 32 | Log::warning("Prefixed table '{$this->prefix}{$table}' already exists. Verify your migration status."); |
|
| 33 | continue; // Migration may be partly done already... |
|
| 34 | } |
|
| 35 | ||
| 36 | Schema::rename($table, $this->prefix . $table); |
|
| 37 | } catch (Throwable $e) { |
|
| 38 | Log::error($e->getMessage()); |
|
| 39 | } |
|
| 40 | } |
|
| 41 | } |
|
| 42 | ||
| 43 | public function down(): void |
|
| 44 | { |
|
| @@ 43-57 (lines=15) @@ | ||
| 40 | } |
|
| 41 | } |
|
| 42 | ||
| 43 | public function down(): void |
|
| 44 | { |
|
| 45 | foreach ($this->tables as $table) { |
|
| 46 | try { |
|
| 47 | if (Schema::hasTable($table)) { |
|
| 48 | Log::warning("Un-prefixed table '{$table}' already exists. Verify your migration status."); |
|
| 49 | continue; // Migration may be partly done already... |
|
| 50 | } |
|
| 51 | ||
| 52 | Schema::rename($this->prefix . $table, $table); |
|
| 53 | } catch (Throwable $e) { |
|
| 54 | Log::error($e->getMessage()); |
|
| 55 | } |
|
| 56 | } |
|
| 57 | } |
|
| 58 | } |
|
| 59 | ||