From: Tom Hughes Date: Sat, 3 Dec 2022 10:59:14 +0000 (+0000) Subject: Merge remote-tracking branch 'upstream/pull/3126' X-Git-Tag: live~1573 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/12c1d5e6c05813a0697724277b4d8529a1a7c240?hp=d90bbff3464e46b4094aa702a86eb054057234bd Merge remote-tracking branch 'upstream/pull/3126' --- diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 79811c612..aa31089c5 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -40,7 +40,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: | diff --git a/INSTALL.md b/INSTALL.md index b14a2d32b..b9aa1a329 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -188,14 +188,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: diff --git a/db/migrate/028_add_more_changeset_indexes.rb b/db/migrate/028_add_more_changeset_indexes.rb index d7a6df7ab..fcbc24ed7 100644 --- a/db/migrate/028_add_more_changeset_indexes.rb +++ b/db/migrate/028_add_more_changeset_indexes.rb @@ -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 diff --git a/docker/postgres/openstreetmap-postgres-init.sh b/docker/postgres/openstreetmap-postgres-init.sh index 1a7c58857..53c0ba454 100755 --- a/docker/postgres/openstreetmap-postgres-init.sh +++ b/docker/postgres/openstreetmap-postgres-init.sh @@ -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 diff --git a/script/vagrant/setup/provision.sh b/script/vagrant/setup/provision.sh index c17ddd1d6..bfe12a3c6 100644 --- a/script/vagrant/setup/provision.sh +++ b/script/vagrant/setup/provision.sh @@ -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