Skip to content

Commit

Permalink
Add abstraction method to lic. purpose points (#1375)
Browse files Browse the repository at this point in the history
https://eaflood.atlassian.net/browse/WATER-4645

> Part of the work to migrate return versions from NALD to WRLS

We recently [Updated view licence summary to use new points data](#1316). This is part of a series of changes to help us move away from extracting point information from the licence JSON blob in `permit.licence`.

We're also looking to migrate the pages linked to from the view licence summary, which are currently in the legacy [water-abstraction-ui](https://github.com/DEFRA/water-abstraction-ui). One of them is information on 'points'. We thought we'd captured everything 'point' related in [the changes we made to the points schema](DEFRA/water-abstraction-service#2638) but have since spotted 'Means of abstraction'.

This is linked to an abstraction purpose point in NALD and gives how water will be abstracted there, for example, "Surface Mounted Pump (Fixed)". We'll [populate this field](DEFRA/water-abstraction-import#1029) as we import a licence's point information from NALD.

This change updates the view so we can access the new field.
  • Loading branch information
Cruikshanks authored Oct 7, 2024
1 parent 388d094 commit 8150f96
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ exports.up = function (knex) {
table.text('external_id')
table.integer('nald_point_id')
table.uuid('point_id')
table.text('abstraction_method')

// Legacy timestamps
table.timestamp('date_created', { useTz: false }).notNullable().defaultTo(knex.fn.now())
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
'use strict'

const viewName = 'licence_version_purpose_points'

exports.up = function (knex) {
return knex
.schema
.dropViewIfExists(viewName)
.createView(viewName, (view) => {
view.as(knex('licence_version_purpose_points').withSchema('water').select([
'id',
'licence_version_purpose_id',
'point_id',
'external_id',
'abstraction_method',
'date_created AS created_at',
'date_updated AS updated_at'
]))
})
}

exports.down = function (knex) {
return knex
.schema
.dropViewIfExists(viewName)
.createView(viewName, (view) => {
view.as(knex('licence_version_purpose_points').withSchema('water').select([
'id',
'licence_version_purpose_id',
'point_id',
'external_id',
'date_created AS created_at',
'date_updated AS updated_at'
]))
})
}

0 comments on commit 8150f96

Please sign in to comment.