More work being done in Import script. The old data is in the process of being cleaned up. Once it's clean, we'll have another go at writing the import script

git-svn-id: https://rosehill.googlecode.com/svn/branches/php@43 100bd78a-fc82-11de-b5bc-ffd2847a4b57
This commit is contained in:
inghamn 2010-01-08 17:56:19 +00:00
parent 8f52b48fdf
commit 12c21ef010
1 changed files with 18 additions and 3 deletions

View File

@ -11,6 +11,8 @@ from rosehill.DEED r
left join cemeteries c on r.whiteoak=substr(c.name,1,1); left join cemeteries c on r.whiteoak=substr(c.name,1,1);
update rosehill.ROSEHILL set WHITEOAK='R' where WHITEOAK is null;
insert interments(id,section,lot,book,pageNumber,deceasedDate, insert interments(id,section,lot,book,pageNumber,deceasedDate,
lastname,firstname,middleInitial, lastname,firstname,middleInitial,
birthPlace,lastResidence,age,sex,cemetery_id,notes,lot2) birthPlace,lastResidence,age,sex,cemetery_id,notes,lot2)
@ -21,12 +23,11 @@ from rosehill.ROSEHILL r
left join cemeteries c on r.whiteoak=substr(c.name,1,1); left join cemeteries c on r.whiteoak=substr(c.name,1,1);
-- Migrate the interment sections into a section_id foreign key'd to a sections table
-- A little bit of cleanup on the data -- A little bit of cleanup on the data
update interments set section='P.G.' where section='P.G'; update interments set section='P.G.' where section='P.G';
update interments set section=null where section='0'; update interments set section=null where section='0';
insert sections (code,cemetery_id) insert sections (code,cemetery_id)
select distinct section,1 from interments select distinct section,1 from interments
where cemetery_id=1 and section is not null; where cemetery_id=1 and section is not null;
@ -44,4 +45,18 @@ set section_id=sections.id
where interments.section=sections.code where interments.section=sections.code
and interments.cemetery_id=sections.cemetery_id; and interments.cemetery_id=sections.cemetery_id;
alter table interments drop section; alter table interments drop section;
-- Migrate the deeds sections into a section_id foreign key'd to a sections table
update deeds set section='A' where section='A MA';
update deeds set section='R.H.' where section='R.H';
update deeds set cemetery_id=2 where section='R.H.';
-- R.H. is not a section. It was the way people were marking the Cemetery to be RoseHill
-- In these cases, the lot field has the actual section code
update interments set section_id=33,lot=null where section_id=39;
delete from sections where id=39;
-- A case where people put the lot number in the section field
update interments set section_id=34,lot=49,cemetery_id=2 where section_id=45;
delete from sections where id=45;