diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c12fc6..2fe6b06 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# v8.2.0 (2024-08-05) + +> [!NOTE] Minimum supported Laravel version is bumped to 11.15.0 for #224. + +- Fixed an issue where Schema changes were applied twice. (#224) + # v8.1.3 (2024-06-24) Fixed diff --git a/composer.json b/composer.json index c9d3327..86dbed7 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ "php": "^8.2", "ext-grpc": "*", "ext-json": "*", - "laravel/framework": "^11", + "laravel/framework": "^11.15.0", "google/cloud-spanner": "^1.58.4", "grpc/grpc": "^1.42", "symfony/cache": "~7", diff --git a/src/Eloquent/Model.php b/src/Eloquent/Model.php index 797be74..9d36deb 100644 --- a/src/Eloquent/Model.php +++ b/src/Eloquent/Model.php @@ -24,7 +24,7 @@ use Illuminate\Support\Str; /** - * @mixin Builder + * @mixin Builder */ class Model extends BaseModel { @@ -42,7 +42,7 @@ class Model extends BaseModel public $incrementing = false; /** - * @param BaseModel|Relation $query + * @param BaseModel|Relation $query * @param mixed $value * @param string|null $field * @return BuilderContract @@ -59,7 +59,7 @@ public function resolveRouteBindingQuery($query, $value, $field = null) * @param string $childType * @param mixed $value * @param string|null $field - * @return Relation + * @return Relation */ protected function resolveChildRouteBindingQuery($childType, $value, $field) { diff --git a/src/Schema/Grammar.php b/src/Schema/Grammar.php index 6164901..3a40799 100644 --- a/src/Schema/Grammar.php +++ b/src/Schema/Grammar.php @@ -115,14 +115,19 @@ public function compileCreate(Blueprint $blueprint, Fluent $command) * * @param Blueprint $blueprint * @param Fluent $command - * @return string[] + * @return list|string */ public function compileAdd(Blueprint $blueprint, Fluent $command) { - return $this->prefixArray( - 'alter table '.$this->wrapTable($blueprint).' add column', - $this->getColumns($blueprint) + $column = $command->column; + + $sql = sprintf('alter table %s add column %s %s', + $this->wrapTable($blueprint), + $this->wrap($column), + $this->getType($column), ); + + return $this->addModifiers($sql, $blueprint, $column); } /** @@ -131,14 +136,19 @@ public function compileAdd(Blueprint $blueprint, Fluent $command) * @param Blueprint $blueprint * @param Fluent $command * @param Connection $connection - * @return string[] + * @return list|string */ public function compileChange(Blueprint $blueprint, Fluent $command, Connection $connection) { - return $this->prefixArray( - 'alter table '.$this->wrapTable($blueprint).' alter column', - $this->getChangedColumns($blueprint) + $column = $command->column; + + $sql = sprintf('alter table %s alter column %s %s', + $this->wrapTable($blueprint), + $this->wrap($column), + $this->getType($column), ); + + return $this->addModifiers($sql, $blueprint, $column); } /** @@ -830,6 +840,8 @@ protected function formatTimestampValue(Fluent $column, mixed $value): string /** * Compile the blueprint's column definitions. * + * @deprecated Not used anymore. Will be deleted in 9.x. + * * @param Blueprint $blueprint * @return array */