Skip to content

Skip truncation of spatial_ref_sys table#15

Merged
seuros merged 1 commit into
seuros:masterfrom
vicocamacho:feat/dont-truncate-spatial-ref-sys
Nov 6, 2025
Merged

Skip truncation of spatial_ref_sys table#15
seuros merged 1 commit into
seuros:masterfrom
vicocamacho:feat/dont-truncate-spatial-ref-sys

Conversation

@vicocamacho
Copy link
Copy Markdown
Contributor

@vicocamacho vicocamacho commented Oct 27, 2025

As I was incorporating the gem into a project I'm working on I discovered that when Rails runs its test in parallel the spatial_ref_sys table gets truncated.

This PR adds this table to the skip table lists when truncating.

This should fix the error reported in #14

@vicocamacho vicocamacho changed the title Skip truncation of spatial_ref_system table Skip truncation of spatial_ref_sys table Oct 27, 2025
@navidemad
Copy link
Copy Markdown

I tried your branch in my project, and it fixed my issue 👍🏻

Comment on lines +7 to +10
def truncate_tables(*table_names)
table_names -= [ "spatial_ref_sys" ]
super(*table_names)
end
Copy link
Copy Markdown

@navidemad navidemad Oct 28, 2025

Choose a reason for hiding this comment

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

Suggested change
def truncate_tables(*table_names)
table_names -= [ "spatial_ref_sys" ]
super(*table_names)
end
# PostGIS system tables that must never be truncated
# These contain critical spatial reference and metadata
POSTGIS_SYSTEM_TABLES = %w[spatial_ref_sys geometry_columns geography_columns raster_columns raster_overviews].freeze
def truncate_tables(*table_names)
# Filter out PostGIS system tables
table_names -= POSTGIS_SYSTEM_TABLES
super(*table_names)
end

@seuros seuros merged commit efe3233 into seuros:master Nov 6, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants