-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add migration to update to newer PostGis
- Loading branch information
1 parent
7e80795
commit 74977c7
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
geoapi/migrations/versions/20241207_0329-6495ed2ce317_update_postgis_2_5_to_3_3.py
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
"""update_postgis_2_5_to_3_3 | ||
Revision ID: 6495ed2ce317 | ||
Revises: 968f358e102a | ||
Create Date: 2024-12-07 03:29:34.254577 | ||
Updates PostGIS extension to match container version (3.3). This migration drops and recreates the PostGIS | ||
extensions to resolve library version mismatch issue. | ||
""" | ||
|
||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "6495ed2ce317" | ||
down_revision = "968f358e102a" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# Drop extensions in correct order | ||
op.execute("DROP EXTENSION IF EXISTS postgis_topology CASCADE;") | ||
op.execute("DROP EXTENSION IF EXISTS postgis CASCADE;") | ||
|
||
# Create new PostGIS extensions | ||
op.execute("CREATE EXTENSION postgis;") | ||
op.execute("CREATE EXTENSION postgis_topology;") | ||
|
||
|
||
def downgrade(): | ||
pass # We don't want to downgrade PostGIS version |