Skip to content

Commit

Permalink
Installation updates (#2350)
Browse files Browse the repository at this point in the history
* Ensure random_move_type creates a valid move_type

`UNKNOWN` is not in the list of move_types

* Remove column `{:null=>false}` from schema

This column name broke the ERD generator. It was introduced by
this issue (now resolved) in PaperTrail:

paper-trail-gem/paper_trail#1347

* Update README

Adds notes that:
- Reference data should be loaded before generating Auth tokens
- Locations are cached in Redis
  • Loading branch information
tobyprivett authored Oct 1, 2024
1 parent 9c21a7f commit b6078f9
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 19 deletions.
40 changes: 25 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,31 @@ After setup should then be able to run the local Web server:
bundle exec rails server
```

### Create reference data

To create reference data (seed data) needed in production run the
following rake task:

```bash
bundle exec rake reference_data:create_all
```

Some of these tasks pull data from NOMIS and therefore require
environment variables configured with the relevant security credentials.

These tasks are designed to be non-destructive. They can be run multiple
times and will only modify data if the original data source has changed.

Note: Locations are cached in Redis. If the frontend errors with a 404 'Location could not be found', clear out the Redis cache:
```
redis-cli flushall
```


### Creating client credentials

Note: This task asks for the supplier key ("geoamey", "serco" or "none"), so ensure that the reference data has been loaded first.

The application implements OAuth2 client credentials flow. To generate new application client credentials, use the following Rake task:

```bash
Expand Down Expand Up @@ -74,21 +97,6 @@ We use Rubocop for code linting, to run the checks:
bundle exec rubocop
```

### Create reference data

To create reference data (seed data) needed in production run the
following rake task:

```bash
bundle exec rake reference_data:create_all
```

Some of these tasks pull data from NOMIS and therefore require
environment variables configured with the relevant security credentials.

These tasks are designed to be non-destructive. They can be run multiple
times and will only modify data if the original data source has changed.

### Create fake transactional data

To optionally create fake transactional data to use for testing and in a development environment run:
Expand Down Expand Up @@ -117,6 +125,8 @@ bundle exec rake frameworks:populate_data['/path/to/hmpps-book-secure-move-frame

The path to the frameworks folder and the semantic version can be specified.

Note: The active Framework is assigned to the Person Escort Record on create. When a new Framework is loaded, it will only be available for newly created records.

## Documentation

### Swagger API documentation
Expand Down
5 changes: 2 additions & 3 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.0].define(version: 2024_05_02_112955) do
ActiveRecord::Schema[7.1].define(version: 2024_05_02_112955) do
# These are extensions that must be enabled in order to support this database
enable_extension "citext"
enable_extension "pgcrypto"
Expand Down Expand Up @@ -656,8 +656,7 @@
end

create_table "versions", force: :cascade do |t|
t.string "item_type"
t.string "{:null=>false}"
t.string "item_type", null: false
t.uuid "item_id", null: false
t.string "event", null: false
t.string "whodunnit"
Expand Down
2 changes: 1 addition & 1 deletion lib/tasks/fake_data/journeys.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def random_move_type(from_location, to_location)
elsif to_location.hospital?
'hospital'
else
'UNKNOWN'
'approved_premises'
end
end

Expand Down

0 comments on commit b6078f9

Please sign in to comment.