Skip to content
This repository was archived by the owner on Mar 19, 2026. It is now read-only.

Add unique constraint on UnitRespondingAgency#326

Open
hancush wants to merge 1 commit into
masterfrom
unitrespondingagency_constraint
Open

Add unique constraint on UnitRespondingAgency#326
hancush wants to merge 1 commit into
masterfrom
unitrespondingagency_constraint

Conversation

@hancush

@hancush hancush commented Mar 4, 2019

Copy link
Copy Markdown
Member

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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants