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 unique constraint on UnitRespondingAgency #326

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hancush
Copy link
Member

@hancush hancush commented Mar 4, 2019

This PR leverages unique_together to add a unique constraint on UnitRespondingAgency, such that units may only be associated with one responding agency per year.

                                   Table "public.payroll_unitrespondingagency"
        Column        |  Type   | Collation | Nullable |                         Default
----------------------+---------+-----------+----------+----------------------------------------------------------
 id                   | integer |           | not null | nextval('payroll_unitrespondingagency_id_seq'::regclass)
 reporting_year       | integer |           | not null |
 responding_agency_id | integer |           | not null |
 unit_id              | integer |           | not null |
Indexes:
...
    "payroll_unitrespondingag_unit_id_reporting_year_988eebd6_uniq" UNIQUE CONSTRAINT, btree (unit_id, reporting_year)
...

Related to #324.

@hancush hancush requested a review from fgregg March 4, 2019 22:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants