Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.x] Improve formatPostGisType method readability #30593

Merged
merged 2 commits into from Nov 15, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php
Expand Up @@ -888,11 +888,15 @@ protected function typeMultiPolygonZ(Fluent $column)
*/
private function formatPostGisType(string $type, Fluent $column)
{
if ($column->isGeometry !== null) {
return "geometry($type".($column->projection === null ? '' : ", $column->projection").')';
if ($column->isGeometry === null) {
return sprintf('geography(%s, %s)', $type, $column->projection ?? '4326');
}

return "geography($type, ".($column->projection ?? '4326').')';
if ($column->projection !== null) {
return sprintf('geometry(%s, %s)', $type, $column->projection);
}

return "geometry({$type})";
antonkomarev marked this conversation as resolved.
Show resolved Hide resolved
}

/**
Expand Down