From 573954c45f68ccbb117b99ae6190c5fa89751ceb Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Tue, 4 Jul 2023 11:38:18 +0200 Subject: [PATCH] feat(postgis): enable postgis --- config/application.rb | 11 +++++++++++ db/migrate/20230704093503_enable_postgis.rb | 5 +++++ db/schema.rb | 3 ++- 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20230704093503_enable_postgis.rb diff --git a/config/application.rb b/config/application.rb index 36183bc48..a38123215 100644 --- a/config/application.rb +++ b/config/application.rb @@ -103,5 +103,16 @@ module TPS config.active_record.encryption.primary_key = Rails.application.secrets.active_record_encryption.fetch(:primary_key) config.active_record.encryption.key_derivation_salt = Rails.application.secrets.active_record_encryption.fetch(:key_derivation_salt) + + # Copied from rgeo/activerecord-postgis-adapter + ActiveRecord::SchemaDumper.ignore_tables |= [ + 'geography_columns', + 'geometry_columns', + 'layer', + 'raster_columns', + 'raster_overviews', + 'spatial_ref_sys', + 'topology' + ] end end diff --git a/db/migrate/20230704093503_enable_postgis.rb b/db/migrate/20230704093503_enable_postgis.rb new file mode 100644 index 000000000..2b2e2b35a --- /dev/null +++ b/db/migrate/20230704093503_enable_postgis.rb @@ -0,0 +1,5 @@ +class EnablePostgis < ActiveRecord::Migration[7.0] + def change + enable_extension :postgis + end +end diff --git a/db/schema.rb b/db/schema.rb index cd6e7611a..12983a65a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,10 +10,11 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2023_07_18_113820) do +ActiveRecord::Schema[7.0].define(version: 2023_07_18_113920) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql" + enable_extension "postgis" enable_extension "unaccent" create_table "action_text_rich_texts", force: :cascade do |t|