diff --git a/app/generate-migrations.php b/app/generate-migrations.php index 861e9d1..bf4f91e 100644 --- a/app/generate-migrations.php +++ b/app/generate-migrations.php @@ -176,7 +176,10 @@ class ColumnParser foreach ($validOptions as $validOption => $callable) { if (str_contains(strtolower($this->line), $validOption)) { list($option, $value) = $callable($parts); - if (!is_bool($value) and !ctype_digit($value)) { + if (strtolower($value) === 'null') { + $value = 'null'; + } + if ($value !== 'null' and !is_bool($value) and !ctype_digit($value)) { $value = trim($value, "'"); $value = "'{$value}'"; } @@ -490,7 +493,10 @@ use Phinx\Seed\AbstractSeed; if (is_bool($value)) { $value = $value ? 1 : 0; } - if (!ctype_digit("{$value}")) { + if (!ctype_digit("{$value}") and $value !== null) { + if (str_contains($value, "'")) { + $value = str_replace("'", "\'", $value); + } $value = "'{$value}'"; } $output []= "\t\t\t\t'{$key}' => {$value},";