-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Since version 3.4.0 doctrine:migration:diff generates a migration to drop spatial_ref_sys table used by PostGIS extension #5668
Comments
How can this issue be reproduced without the dependencies like Migrations? I deployed a PostgreSQL server instance from the postgis/postgis container image. I can confirm that the table in question exists: DROP TABLE spatial_ref_sys
-- [2BP01] ERROR: cannot drop table spatial_ref_sys because extension postgis requires it
-- Hint: You can drop extension postgis instead. But I cannot see it listed via |
Hello, in version 3.3.8, |
@lmichelin we need to agree on the environment where this issue can be reproduced. So far, I cannot reproduce it. Here's what I did:
As you can see, the script fails to drop the table in question (meaning that it exists) but it doesn't list it. Although, it lists a bunch of other tables supposedly owned by the extension. Please try reproducing your issue using this container image and the script. |
I followed these 3 steps to reproduce your test and I can confirm I have the same output as yours. Actually there is no issue with the To reproduce it you can do the following test:
<?php
use Doctrine\DBAL\DriverManager;
use Doctrine\DBAL\Exception;
require 'vendor/autoload.php';
$connection = DriverManager::getConnection([
'driver' => 'pdo_pgsql',
'host' => 'localhost',
'user' => 'postgres',
'password' => 'Passw0rd',
]);
// keep only postgis extension to have only the spatial_ref_sys table
$connection->executeStatement('DROP EXTENSION IF EXISTS postgis_tiger_geocoder');
$connection->executeStatement('DROP EXTENSION IF EXISTS postgis_topology');
try {
$connection->executeStatement('DROP TABLE spatial_ref_sys');
} catch (Exception $e) {
echo $e->getMessage().PHP_EOL;
}
$schemaManager = $connection->createSchemaManager();
$tables = $schemaManager->listTables();
echo 'Tables count: '.count($tables).PHP_EOL;
foreach ($tables as $table) {
echo $table->getName().PHP_EOL;
}
|
Thanks for the details, @lmichelin. Please check if #5687 works for you. |
I just tried your fork and it works, thanks! 🎉 |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Bug Report
Summary
I'm using PostgreSQL with PostGIS extension. Since version
3.4.0
, when I run thedoctrine:migration:diff
command, a migration is generated to drop thespatial_ref_sys
table used by PostGIS.Current behaviour
Generated migration:
Output when I run the migration:
How to reproduce
CREATE EXTENSION IF NOT EXISTS "postgis"
)doctrine:migration:diff
commandExpected behaviour
The
doctrine:migration:diff
should not generate any migration to remove thespatial_ref_sys
table, like in version3.3.8
.The text was updated successfully, but these errors were encountered: