Sections are now stored in a seperate table, with forign keys from the Intements
git-svn-id: https://rosehill.googlecode.com/svn/trunk@54 100bd78a-fc82-11de-b5bc-ffd2847a4b57
This commit is contained in:
parent
c6651e9260
commit
6ef9aac9a1
|
@ -2,16 +2,6 @@ insert cemeteries set id=1,name='White Oak';
|
|||
insert cemeteries set id=2,name='Rose Hill';
|
||||
|
||||
|
||||
insert deeds (id,section,lot,lastname1,firstname1,middleInitial1,
|
||||
lastname2,firstname2,middleInitial2,issueDate,notes,lot2,cemetery_id)
|
||||
select r.ID,r.SEC,r.LOT,r.LNAME1,r.FNAME1,r.MI1,
|
||||
r.LNAME2,r.FNAME2,r.MI2,r.DATE_ISSUE,r.NOTES,r.lot2,c.id
|
||||
from rosehill.DEED r
|
||||
left join cemeteries c on r.whiteoak=substr(c.name,1,1);
|
||||
|
||||
|
||||
update rosehill.ROSEHILL set WHITEOAK='R' where WHITEOAK is null;
|
||||
|
||||
insert sections (code,cemetery_id)
|
||||
select distinct SEC,1 from rosehill.ROSEHILL where WHITEOAK='W' and SEC is not null;
|
||||
|
||||
|
@ -19,6 +9,8 @@ insert sections (code,cemetery_id)
|
|||
select distinct SEC,2 from rosehill.ROSEHILL where WHITEOAK='R' and SEC is not null;
|
||||
|
||||
|
||||
|
||||
|
||||
insert interments(id,section_id,lot,book,pageNumber,deceasedDate,
|
||||
lastname,firstname,middleInitial,
|
||||
birthPlace,lastResidence,age,sex,cemetery_id,notes,lot2)
|
||||
|
@ -28,3 +20,13 @@ select r.ID,s.id,r.LOT,r.BOOK,r.PAGENUM,r.DEATH,
|
|||
from rosehill.ROSEHILL r
|
||||
left join cemeteries c on r.WHITEOAK=substr(c.name,1,1)
|
||||
left join sections s on r.SEC=s.code and c.id=s.cemetery_id;
|
||||
|
||||
|
||||
|
||||
insert deeds (id,section_id,lot,lastname1,firstname1,middleInitial1,
|
||||
lastname2,firstname2,middleInitial2,issueDate,notes,lot2,cemetery_id)
|
||||
select r.ID,s.id,r.LOT,r.LNAME1,r.FNAME1,r.MI1,
|
||||
r.LNAME2,r.FNAME2,r.MI2,r.DATE_ISSUE,r.NOTES,r.lot2,c.id
|
||||
from rosehill.DEED r
|
||||
left join cemeteries c on r.whiteoak=substr(c.name,1,1)
|
||||
left join sections s on r.SEC=s.code and c.id=s.cemetery_id;
|
||||
|
|
|
@ -48,7 +48,7 @@ create table sections (
|
|||
|
||||
create table deeds (
|
||||
id int unsigned not null primary key auto_increment,
|
||||
section varchar(5),
|
||||
section_id int unsigned,
|
||||
lot varchar(5),
|
||||
lastname1 varchar(20),
|
||||
firstname1 varchar(20),
|
||||
|
@ -60,6 +60,7 @@ create table deeds (
|
|||
notes text,
|
||||
lot2 char(5),
|
||||
cemetery_id int unsigned,
|
||||
foreign key (section_id) references sections(id),
|
||||
foreign key (cemetery_id) references cemeteries(id)
|
||||
) engine=InnoDB;
|
||||
|
||||
|
|
Loading…
Reference in New Issue