]> git.openstreetmap.org Git - rails.git/commitdiff
Automatically enable the btree_gist extension
authorAndy Allan <git@gravitystorm.co.uk>
Wed, 10 Mar 2021 18:20:03 +0000 (18:20 +0000)
committerAndy Allan <git@gravitystorm.co.uk>
Wed, 10 Mar 2021 18:24:36 +0000 (18:24 +0000)
This simplifies the install instructions. Loading from structure.sql is already handled.

.github/workflows/tests.yml
INSTALL.md
db/migrate/028_add_more_changeset_indexes.rb
docker/postgres/openstreetmap-postgres-init.sh
script/vagrant/setup/provision.sh

index 87b7b51ea6d29c02411bb29a9515ce0e0f06028e..15283da66cb619c8f1f69c6f3c604003c5d7ee8d 100644 (file)
@@ -48,7 +48,6 @@ jobs:
         sudo systemctl start postgresql
         sudo -u postgres createuser -s $(id -un)
         createdb openstreetmap
-        psql -c "CREATE EXTENSION btree_gist" openstreetmap
         psql -f db/functions/functions.sql openstreetmap
     - name: Configure rails
       run: |
index c8811fc3fcc54ccff2068765268a75b7438660b8..e2f46d9003f07d17b072e5bf5f58b5d4512c02f9 100644 (file)
@@ -190,14 +190,6 @@ To create the three databases - for development, testing and production - run:
 bundle exec rake db:create
 ```
 
-### PostgreSQL Btree-gist Extension
-
-We need to load the `btree-gist` extension, which is needed for showing changesets on the history tab.
-
-```
-psql -d openstreetmap -c "CREATE EXTENSION btree_gist"
-```
-
 ### PostgreSQL Functions
 
 We need to install some special functions into the PostgreSQL database:
index d7a6df7abb92050c32fa86355f371785e4bc1b77..fcbc24ed71292123e644ebab9e4792a6a37e09d2 100644 (file)
@@ -1,5 +1,7 @@
 class AddMoreChangesetIndexes < ActiveRecord::Migration[4.2]
   def self.up
+    enable_extension "btree_gist"
+
     add_index "changesets", ["created_at"], :name => "changesets_created_at_idx"
     add_index "changesets", ["closed_at"], :name => "changesets_closed_at_idx"
     add_index "changesets", %w[min_lat max_lat min_lon max_lon], :name => "changesets_bbox_idx", :using => "GIST"
@@ -9,5 +11,7 @@ class AddMoreChangesetIndexes < ActiveRecord::Migration[4.2]
     remove_index "changesets", :name => "changesets_bbox_idx"
     remove_index "changesets", :name => "changesets_closed_at_idx"
     remove_index "changesets", :name => "changesets_created_at_idx"
+
+    disable_extension "btree_gist"
   end
 end
index 1a7c58857c9553b17ee76832a8d82b67ebe93bee..53c0ba4549c9a2f46a9c72ebf26b5fb8f701dae5 100755 (executable)
@@ -8,8 +8,5 @@ psql -v ON_ERROR_STOP=1 -U "$POSTGRES_USER" <<-EOSQL
     GRANT ALL PRIVILEGES ON DATABASE openstreetmap TO openstreetmap;
 EOSQL
 
-# Create btree_gist extensions
-psql -v ON_ERROR_STOP=1 -U "$POSTGRES_USER" -c "CREATE EXTENSION btree_gist" openstreetmap
-
 # Define custom functions
 psql -v ON_ERROR_STOP=1 -U "$POSTGRES_USER" -f "/usr/local/share/osm-db-functions.sql" openstreetmap
index e2cacfff360751ef9c39262085f8d62949848475..93e91e721dc8e0f8d04f36f39254f2846344d855 100644 (file)
@@ -36,9 +36,6 @@ if [ "$db_user_exists" != "1" ]; then
     sudo -u postgres createuser -s vagrant
     sudo -u vagrant createdb -E UTF-8 -O vagrant openstreetmap
     sudo -u vagrant createdb -E UTF-8 -O vagrant osm_test
-    # add btree_gist extension
-    sudo -u vagrant psql -c "create extension btree_gist" openstreetmap
-    sudo -u vagrant psql -c "create extension btree_gist" osm_test
 fi