Skip to content

Commit

Permalink
feat: fix empty query alter
Browse files Browse the repository at this point in the history
  • Loading branch information
dewanakl committed May 10, 2024
1 parent ace460e commit 8f11efb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Core/Database/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,12 @@ public function export(): string|null
}
}

$query = 'ALTER TABLE ' . $this->table . ' ' . join(', ', array_map(fn ($data) => $this->alter . ' ' . $data, $this->query)) . ';';
$query = array_map(fn ($data) => $this->alter . ' ' . $data, $this->query);
if (count($query) == 0) {
return null;
}

$query = 'ALTER TABLE ' . $this->table . ' ' . join(', ', $query) . ';';
$this->query = [];
$this->alter = null;
$this->columns = [];
Expand Down

0 comments on commit 8f11efb

Please sign in to comment.