This simplifies the install instructions. Loading from structure.sql is already handled.
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: |
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:
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"
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
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
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