Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/Bosnadev/Database/Schema/Grammars/PostgresGrammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand All @@ -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);
}

Expand Down