diff --git a/src/Bosnadev/Database/Schema/Grammars/PostgresGrammar.php b/src/Bosnadev/Database/Schema/Grammars/PostgresGrammar.php index fb13fcc..0bb9525 100644 --- a/src/Bosnadev/Database/Schema/Grammars/PostgresGrammar.php +++ b/src/Bosnadev/Database/Schema/Grammars/PostgresGrammar.php @@ -2,6 +2,7 @@ namespace Bosnadev\Database\Schema\Grammars; +use Illuminate\Contracts\Database\Query\Expression; use Illuminate\Support\Fluent; use Illuminate\Database\Schema\Blueprint as BaseBlueprint; use Bosnadev\Database\Schema\Blueprint; @@ -284,7 +285,7 @@ protected function typeTsvector(Fluent $column) */ protected function getDefaultValue($value) { - if($this->isUuid($value)) return strval($value); + if($this->isUuid($value)) return $value instanceof Expression ? $this->getValue($value) : strval($value); return parent::getDefaultValue($value); } @@ -297,6 +298,10 @@ protected function getDefaultValue($value) */ protected function isUuid($value) { + if ($value instanceof Expression) { + $value = $this->getValue($value); + } + return preg_match('/^uuid_generate_v/', $value); }