Page 1 of 1

Insert NI counties into v1.4.8b DB

Posted: Mon Aug 30, 2010 10:01 pm
by Moggin
Can I update a 1.4.8b database to include the Northern Ireland counties, included in 1.4.9?

I pulled this directly from the upgrade.sql file, and executed it in phpmyadmin, on a test installation. It seemed to work: can anyone foresee any problems (bearing in mind I'm a MySQL noob?)
I understand the warning about DB prefixes, which is also in the file.

Code: Select all

DELETE FROM `zone` WHERE `code` = 'ANT';
DELETE FROM `zone` WHERE `code` = 'ARM';
DELETE FROM `zone` WHERE `code` = 'DOW';
DELETE FROM `zone` WHERE `code` = 'FER';
DELETE FROM `zone` WHERE `code` = 'LDY';
DELETE FROM `zone` WHERE `code` = 'TYR';

INSERT INTO `zone` (`zone_id`, `country_id`, `code`, `name`, `status`) VALUES (NULL, 222, 'ANT', 'County Antrim', 1) ON DUPLICATE KEY UPDATE zone_id=zone_id;
INSERT INTO `zone` (`zone_id`, `country_id`, `code`, `name`, `status`) VALUES (NULL, 222, 'ARM', 'County Armagh', 1) ON DUPLICATE KEY UPDATE zone_id=zone_id;
INSERT INTO `zone` (`zone_id`, `country_id`, `code`, `name`, `status`) VALUES (NULL, 222, 'DOW', 'County Down', 1) ON DUPLICATE KEY UPDATE zone_id=zone_id;
INSERT INTO `zone` (`zone_id`, `country_id`, `code`, `name`, `status`) VALUES (NULL, 222, 'FER', 'County Fermanagh', 1) ON DUPLICATE KEY UPDATE zone_id=zone_id;
INSERT INTO `zone` (`zone_id`, `country_id`, `code`, `name`, `status`) VALUES (NULL, 222, 'LDY', 'County Londonderry', 1) ON DUPLICATE KEY UPDATE zone_id=zone_id;
INSERT INTO `zone` (`zone_id`, `country_id`, `code`, `name`, `status`) VALUES (NULL, 222, 'TYR', 'County Tyrone', 1) ON DUPLICATE KEY UPDATE zone_id=zone_id; 
Could I also use it as a template to put in a new UK county; eg if a new county of Mogland was declared, or something?

Thanks to anyone who can spare time to glance at this.

Re: Insert NI counties into v1.4.8b DB

Posted: Tue Aug 31, 2010 9:25 am
by JAY6390
Hey Moggin,
As long as the id of the county is unique, and it's country ID relates to the country you want it to be in, you can pretty much edit it as you want

Re: Insert NI counties into v1.4.8b DB

Posted: Tue Aug 31, 2010 9:49 am
by Qphoria
Yea, I used null so that the auto-increment would always have the correct id so there should be no problem using that bit from the upgrade.sql

Re: Insert NI counties into v1.4.8b DB

Posted: Tue Aug 31, 2010 10:14 pm
by Moggin
Many thanks, Jay, and Qphoria! That's taken a small load off my mind. :)