1
0
Fork 0

Remove column Relationship#until_date

This commit is contained in:
Alex Kotov 2019-08-15 07:46:13 +05:00
parent 36d80f15a0
commit ee381bdecf
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
2 changed files with 1 additions and 8 deletions

View file

@ -335,8 +335,7 @@ private
t.references :regional_office,
null: false, index: true, foreign_key: true
t.date :from_date, null: false, index: true
t.date :until_date, null: true, index: false
t.date :from_date, null: false, index: true
t.column :status, :relationship_status, null: false, index: true
t.column :role, :relationship_role, null: true, index: true
@ -387,10 +386,6 @@ private
is_good_small_text(public_name)
SQL
constraint :relationships, :dates, <<~SQL
until_date IS NULL OR from_date < until_date
SQL
constraint :relationships, :role, <<~SQL
status = 'member' OR role IS NULL
SQL

View file

@ -688,12 +688,10 @@ CREATE TABLE public.relationships (
person_id bigint NOT NULL,
regional_office_id bigint NOT NULL,
from_date date NOT NULL,
until_date date,
status public.relationship_status NOT NULL,
role public.relationship_role,
federal_secretary_flag public.relationship_federal_secretary_flag,
regional_secretary_flag public.relationship_regional_secretary_flag,
CONSTRAINT dates CHECK (((until_date IS NULL) OR (from_date < until_date))),
CONSTRAINT federal_secretary_flag CHECK (((federal_secretary_flag IS NULL) OR (role = 'federal_manager'::public.relationship_role))),
CONSTRAINT regional_secretary_flag CHECK (((regional_secretary_flag IS NULL) OR (role = 'regional_manager'::public.relationship_role))),
CONSTRAINT role CHECK (((status = 'member'::public.relationship_status) OR (role IS NULL)))