Mainly, added the dwellings table, implied by the revised ERD.
Some other tidy up.
This commit is contained in:
parent
162274c23f
commit
f86c5cffe6
8 changed files with 1258 additions and 274 deletions
8
resources/migrations/20180526162051-dwellings.down.sql
Normal file
8
resources/migrations/20180526162051-dwellings.down.sql
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
alter table electors
|
||||
add column address_id references addresses on delete no action;
|
||||
|
||||
update electors
|
||||
set address_id =
|
||||
(select address_id
|
||||
from dwellings
|
||||
where dwellings.id electors.dwelling_id);
|
||||
11
resources/migrations/20180526162051-dwellings.up.sql
Normal file
11
resources/migrations/20180526162051-dwellings.up.sql
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
CREATE TABLE dwellings
|
||||
(
|
||||
id INT NOT NULL PRIMARY KEY,
|
||||
address_id INT NOT NULL references addresses on delete no action,
|
||||
sub_address VARCHAR( 32)
|
||||
);
|
||||
|
||||
alter table electors
|
||||
add column dwelling_id int references dwellings on delete no action;
|
||||
|
||||
alter table electors drop column address_id;
|
||||
Loading…
Add table
Add a link
Reference in a new issue