Created
October 31, 2022 09:11
-
-
Save ivoba/74a143d8074110ef47f93a581bb0c3f6 to your computer and use it in GitHub Desktop.
Postgis Postgres Platform for Doctrine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\DBAL; | |
use Doctrine\DBAL\Platforms\PostgreSQLPlatform as PostgreSqlPlatformBase; | |
class PostgisPostgreSqlPlatform extends PostgreSqlPlatformBase | |
{ | |
public function getListNamespacesSQL() | |
{ | |
# exclude postgis schemas | |
return "SELECT schema_name AS nspname | |
FROM information_schema.schemata | |
WHERE schema_name NOT LIKE 'pg\_%' | |
AND schema_name NOT LIKE 'topology' | |
AND schema_name NOT LIKE 'tiger%' | |
AND schema_name != 'information_schema'"; | |
} | |
public function getListSequencesSQL($database) | |
{ | |
return 'SELECT sequence_name AS relname, | |
sequence_schema AS schemaname, | |
minimum_value AS min_value, | |
increment AS increment_by | |
FROM information_schema.sequences | |
WHERE sequence_catalog = ' . $this->quoteStringLiteral($database) . " | |
AND sequence_schema NOT LIKE 'pg\_%' | |
AND sequence_schema NOT LIKE 'topology%' | |
AND sequence_schema NOT LIKE 'tiger%' | |
AND sequence_schema != 'information_schema'"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See: https://nerdpress.org/2022/10/31/doctrine-migrations-and-postgis/
and https://gist.github.com/dextervip/a2f384050748d6ee3ed7d573425e9d58