Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add defaults to unused returns & lines table columns #2346

Closed
wants to merge 2 commits into from

Conversation

Jozzey
Copy link
Contributor

@Jozzey Jozzey commented Nov 22, 2023

DEFRA/water-abstraction-team#106

As part of making the migrations work in water-abstraction-system we have been creating DB Views of the legacy Returns data that better represent the data as we use it in our new service. Part of this exercise is pruning out the unused columns that exist in the legacy tables that are not utilised.

However, we have found that for some of the columns in the legacy data, whilst pointless, still need to be populated as they are set to Not Nullable in the legacy database tables. Therefore, we will set a default value for these columns in the legacy DB so that they are always populated even when they do not exist in our new Views.

The table columns that will be affected by this PR are:

  • returns.regime - this is always "water" so it will default to "water"
  • returns.licence_type - this is always "abstraction" so it will default to "abstraction"
  • lines.substance - surprise, surprise, this is always "water" so it will default to "water"
  • lines.unit - This is always "m³" so it will default to "m³"

DEFRA/water-abstraction-team#106

As part of making the migrations work in `water-abstraction-system` we have been creating DB Views of the legacy Returns data that better represent the data as we use it in our new nervice. Part of this exercise is pruning out the unused columns that exist in the legacy tables that are not utilised.

However we have found that for some of the columns in the legacy data, whilst pointless, still need to be populated as they are set to Not Nullable in the legacy database tables. We are therefore going to set a default value for these columns in the legacy DB so that they are always populated even when they do not exist in our new Views.

The tables that will have migrations written for them in this PR are:
- `returns.regime` - this is always "water" so will default to "water"
- `returns.licence_type` - this is always "abstraction" so will default to "abstraction"
- `lines.substance` - surprise, surprise, this is always "water" so will default to "water"
- `lines.unit` - This is always "m³" so will default to "m³"
@Jozzey Jozzey added the housekeeping Refactoring, tidying up or other work which supports the project label Nov 22, 2023
@Jozzey Jozzey self-assigned this Nov 22, 2023
@Jozzey Jozzey closed this Nov 22, 2023
@Jozzey Jozzey reopened this Nov 22, 2023
@Jozzey
Copy link
Contributor Author

Jozzey commented Nov 22, 2023

I created the migrations in the wrong repo. Should have created them in the Returns repo

@Jozzey Jozzey closed this Nov 22, 2023
@Jozzey Jozzey deleted the add-defaults-to-returns-tables branch November 22, 2023 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
housekeeping Refactoring, tidying up or other work which supports the project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant