-
-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
1 changed file
with
78 additions
and
0 deletions.
There are no files selected for viewing
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,78 @@ | ||
"""empty message | ||
Revision ID: 933717a14052 | ||
Revises: 3381760e2a8c | ||
Create Date: 2022-08-10 15:26:38.960066 | ||
DB Upgrade for name changes OGC API Features components. | ||
Finalizes name-changes in PR | ||
https://github.com/geopython/GeoHealthCheck/pull/431 | ||
Basically this SQL: | ||
UPDATE resource SET resource_type = 'OGCFeat' WHERE resource_type = 'OGC:WFS3'; | ||
UPDATE probe_vars SET probe_class = 'GeoHealthCheck.plugins.probe.ogcfeat.OGCFeatCaps' WHERE probe_class = 'GeoHealthCheck.plugins.probe.wfs3.WFS3Caps'; | ||
UPDATE probe_vars SET probe_class = 'GeoHealthCheck.plugins.probe.ogcfeat.OGCFeatDrilldown' WHERE probe_class = 'GeoHealthCheck.plugins.probe.wfs3.WFS3Drilldown'; | ||
UPDATE probe_vars SET probe_class = 'GeoHealthCheck.plugins.probe.ogcfeat.OGCFeatOpenAPIValidator' WHERE probe_class = 'GeoHealthCheck.plugins.probe.wfs3.WFS3OpenAPIValidator'; | ||
""" | ||
from alembic import op | ||
from sqlalchemy.sql import table, column | ||
from sqlalchemy import String | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = '933717a14052' | ||
down_revision = '3381760e2a8c' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
print('Update (upgrade) records refering to OGC:WFS3 and WFS3 names to OGCFeat') | ||
|
||
resource = table('resource', | ||
column('resource_type', String) | ||
) | ||
|
||
op.execute( | ||
resource.update(). | ||
where(resource.c.resource_type == op.inline_literal('OGC:WFS3')). | ||
values({'resource_type': op.inline_literal('OGCFeat')}) | ||
) | ||
|
||
probe_vars = table('probe_vars', | ||
column('probe_class', String) | ||
) | ||
|
||
op.execute( | ||
probe_vars.update(). | ||
where(probe_vars.c.probe_class == op.inline_literal('GeoHealthCheck.plugins.probe.wfs3.WFS3Caps')). | ||
values({'probe_class': op.inline_literal('GeoHealthCheck.plugins.probe.ogcfeat.OGCFeatCaps')}) | ||
) | ||
|
||
op.execute( | ||
probe_vars.update(). | ||
where(probe_vars.c.probe_class == op.inline_literal('GeoHealthCheck.plugins.probe.wfs3.WFS3Drilldown')). | ||
values({'probe_class': op.inline_literal('GeoHealthCheck.plugins.probe.ogcfeat.OGCFeatDrilldown')}) | ||
) | ||
|
||
op.execute( | ||
probe_vars.update(). | ||
where(probe_vars.c.probe_class == op.inline_literal('GeoHealthCheck.plugins.probe.wfs3.WFS3OpenAPIValidator')). | ||
values({'probe_class': op.inline_literal('GeoHealthCheck.plugins.probe.ogcfeat.OGCFeatOpenAPIValidator')}) | ||
) | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
print('Update (downgrade) records refering to OGCFeat to OGC:WFS3 and WFS3') | ||
resource = table('resource', | ||
column('resource_type', String) | ||
) | ||
|
||
op.execute( | ||
resource.update(). | ||
where(resource.c.resource_type == op.inline_literal('OGCFeat')). | ||
values({'resource_type': op.inline_literal('OGC:WFS3')}) | ||
) | ||
|
||
# ### end Alembic commands ### |