Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ivoba
Created October 31, 2022 09:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ivoba/74a143d8074110ef47f93a581bb0c3f6 to your computer and use it in GitHub Desktop.
Save ivoba/74a143d8074110ef47f93a581bb0c3f6 to your computer and use it in GitHub Desktop.
Postgis Postgres Platform for Doctrine
<?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