Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ specs:
POSTGRES_HOST_AUTH_METHOD: trust
RAILS_ENV: test
services:
- name: postgis/postgis:13-3.3
- name: postgres:13.9
alias: db-postgres
command: ['--fsync=false', '--synchronous_commit=false', '--full_page_writes=false']
- name: redis:7.0
Expand Down
1 change: 0 additions & 1 deletion Brewfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
brew 'postgresql@14'
brew 'postgis'
brew 'redis'
brew 'node@20'
brew 'yarn'
Expand Down
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ ruby "~> #{File.read(File.join(__dir__, '.ruby-version')).strip}"

gem 'rails', '~> 7.1.3'

gem 'activerecord-postgis-adapter', '~> 9.0'
gem 'ahoy_matey', '~> 3.0'
gem 'aws-sdk-kms', '~> 1.4'
gem 'aws-sdk-cloudwatchlogs', require: false
Expand Down
8 changes: 0 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,6 @@ GEM
activemodel (= 7.1.3.2)
activesupport (= 7.1.3.2)
timeout (>= 0.4.0)
activerecord-postgis-adapter (9.0.1)
activerecord (~> 7.1.0)
rgeo-activerecord (~> 7.0.0)
activestorage (7.1.3.2)
actionpack (= 7.1.3.2)
activejob (= 7.1.3.2)
Expand Down Expand Up @@ -576,10 +573,6 @@ GEM
railties (>= 5.0)
retries (0.0.5)
rexml (3.2.6)
rgeo (3.0.0)
rgeo-activerecord (7.0.1)
activerecord (>= 5.0)
rgeo (>= 1.0.0)
rotp (6.3.0)
rouge (4.2.0)
rqrcode (2.1.0)
Expand Down Expand Up @@ -749,7 +742,6 @@ PLATFORMS
ruby

DEPENDENCIES
activerecord-postgis-adapter (~> 9.0)
ahoy_matey (~> 3.0)
aws-sdk-cloudwatchlogs
aws-sdk-kms (~> 1.4)
Expand Down
12 changes: 6 additions & 6 deletions config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ defaults: &defaults
development:
primary:
<<: *defaults
adapter: postgis
adapter: postgresql
migrations_paths: db/primary_migrate
read_replica:
<<: *defaults
adapter: postgis
adapter: postgresql
replica: true
worker_jobs:
<<: *defaults
Expand All @@ -38,7 +38,7 @@ development:
test:
primary: &test
<<: *defaults
adapter: postgis
adapter: postgresql
pool: 10
checkout_timeout: 10
database: <%= ENV['POSTGRES_DB'] || "identity_idp_test#{ENV['TEST_ENV_NUMBER']}" %>
Expand All @@ -47,7 +47,7 @@ test:
migrations_paths: db/primary_migrate
read_replica:
<<: *test
adapter: postgis
adapter: postgresql
replica: true
worker_jobs:
<<: *test
Expand Down Expand Up @@ -80,7 +80,7 @@ test:
production:
primary:
<<: *defaults
adapter: postgis
adapter: postgresql
database: <%= IdentityConfig.store.database_name %>
username: <%= IdentityConfig.store.database_username %>
host: <%= IdentityConfig.store.database_socket.present? ? IdentityConfig.store.database_socket : IdentityConfig.store.database_host %>
Expand All @@ -93,7 +93,7 @@ production:
migrations_paths: db/primary_migrate
read_replica:
<<: *defaults
adapter: postgis
adapter: postgresql
database: <%= IdentityConfig.store.database_name %>
username: <%= IdentityConfig.store.database_readonly_username %>
host: <%= IdentityConfig.store.database_read_replica_host %>
Expand Down
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just to clarify, we don't need a new migration to disable the extension?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ah whoops I made one but forgot to commit it 🤦 PR incoming

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

follow-up PR: #10413

Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
class AddPostgisExtensionToDatabase < ActiveRecord::Migration[7.0]
def change
enable_extension 'postgis'
# In the time since we added this extension, we have removed it and
# also removed the postgis-compatible images from our CI pipeline,
# so running this old migration fails
# enable_extension 'postgis'
end
end
3 changes: 1 addition & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.1].define(version: 2024_04_04_154024) do
ActiveRecord::Schema[7.1].define(version: 2024_04_11_163520) do
# These are extensions that must be enabled in order to support this database
enable_extension "citext"
enable_extension "pg_stat_statements"
enable_extension "pgcrypto"
enable_extension "plpgsql"
enable_extension "postgis"

create_table "account_reset_requests", force: :cascade do |t|
t.integer "user_id", null: false
Expand Down
2 changes: 0 additions & 2 deletions docs/local-development.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ If not using macOS:
- [rbenv](https://github.com/rbenv/rbenv) (lets you install and switch between different versions of Ruby)
- Ruby. Choose the version [in the `.ruby-version` file](../.ruby-version)
- [PostgreSQL](http://www.postgresql.org/download/)
- [PostGIS](https://postgis.net/documentation/getting_started/#installing-postgis)
- Note: if you run into errors installing `postgis` or creating the database, check [the troubleshooting docs](./troubleshooting.md#errors-related-to-the-databse).
- [Redis 7+](http://redis.io/)
- [Node.js v20](https://nodejs.org)
- [Yarn](https://yarnpkg.com/en/)
Expand Down
24 changes: 0 additions & 24 deletions docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,6 @@ $ bundle install
$ yarn install
```

### Errors related to the database

One error you might see is:

```
Caused by:
ActiveRecord::StatementInvalid: PG::FeatureNotSupported: ERROR: extension "postgis" is not available
DETAIL: Could not open extension control file "/opt/homebrew/opt/postgresql@15/share/postgresql@15/extension/postgis.control": No such file or directory.
HINT: The extension must first be installed on the system where PostgreSQL is running.
```

If you see the above message:

- double check that `postgis` is installed with `brew list`
- if `postgis` is listed, it means when you brew installed you might have installed `postgis` in a different postgresql db than the app is using
- in this case, look at `brew list` again, and remove any `postgres` db that is not listed in [the Brewfile](../Brewfile) (`brew uninstall __`)
- if you try to run the migration now you might get a:
```
connection to server at "::1", port 5432 failed: Connection refused
Is the server running on that host and accepting TCP/IP connections?
```
- this likely means postgres is no longer running
- try `brew services start postgresql@14` (or your version) and then re-run the migration

## I am receiving errors when creating the development and test databases

If you receive the following error (where _whoami_ == _your username_):
Expand Down