Skip to content
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

Add postgis extension - a spatial database extender for PostgreSQL #4843

Merged
merged 3 commits into from
Jan 22, 2025

Conversation

tomas-stefano
Copy link
Contributor

@tomas-stefano tomas-stefano commented Jan 22, 2025

Context

This PR adds the postgis extension to Publish/Find.

The postgis adapter does not support Rails 8 at the moment: rgeo/activerecord-postgis-adapter#411 (comment)

So using the extension in it's raw mode.

I’ve encountered issues with the internal tables PostGIS uses for geospatial calculations when recreating the database.

Running the usual setup commands:

rails db:drop db:create db:schema:load db:migrate

leads to this error:

PG::DependentObjectsStillExist: ERROR:  cannot drop table spatial_ref_sys because extension postgis requires it

To work around this, I added the following initializer to ignore spatial_ref_sys during schema dumps:

ActiveRecord::SchemaDumper.ignore_tables |= ["spatial_ref_sys"]

Guidance to review

  1. Does it work on the review app?
    • Run in the review db: SELECT postgis_full_version(); (e.g ActiveRecord::Base.connection.execute("SELECT postgis_full_version();").values)
    • run SELECT * FROM spatial_ref_sys LIMIT 10;
    • run SELECT * FROM geometry_columns LIMIT 10;
  2. Does terraform includes postgis?

The postgis adapter does not support Rails 8 at the moment:
rgeo/activerecord-postgis-adapter#411 (comment)

I’ve encountered issues with the internal tables PostGIS
uses for geospatial calculations when recreating the database.

Running the usual setup commands:

rails db:drop db:create db:schema:load db:migrate

leads to this error:

PG::DependentObjectsStillExist: ERROR:  cannot drop table spatial_ref_sys because extension postgis requires it

To work around this, I added the following initializer to ignore spatial_ref_sys during schema dumps:

ActiveRecord::SchemaDumper.ignore_tables |= ["spatial_ref_sys"]
@tomas-stefano tomas-stefano added the deploy A Review App will be created for PRs with this label label Jan 22, 2025
@tomas-stefano tomas-stefano requested a review from a team as a code owner January 22, 2025 11:55
@tomas-stefano tomas-stefano force-pushed the td/add-postgis-for-location-search branch from 5ac3d73 to b5cc00e Compare January 22, 2025 14:34
Copy link
Contributor

@RMcVelia RMcVelia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

terraform change looks good

@tomas-stefano tomas-stefano force-pushed the td/add-postgis-for-location-search branch from b5cc00e to b073d1c Compare January 22, 2025 16:04
@tomas-stefano tomas-stefano merged commit 430fb78 into main Jan 22, 2025
19 checks passed
@tomas-stefano tomas-stefano deleted the td/add-postgis-for-location-search branch January 22, 2025 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deploy A Review App will be created for PRs with this label
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants