Closed (fixed)
Project:
Location
Version:
6.x-3.1-rc1
Component:
Data update
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
9 Sep 2009 at 01:50 UTC
Updated:
18 Feb 2011 at 22:47 UTC
So I wanted to move from Node Locations to Location CCK, and in the process I also wanted to move to storing multiple locations per node (original was one location per node). I came up with this DB script:
update content_field_location cfl
set field_location_lid = (select lid from location_instance li where li.vid = cfl.vid )
where cfl.field_location_lid is null;
update location_instance
set genid=concat('cck:field_location:', vid)
where nid != 0;
update location_instance
set nid=0, vid=0
where nid != 0;
It seems to have worked. Could anyone comment on this approach? It's admittedly a bit specific to my situation, but I'm sure the concept could be easily extended to single-single and multi-multi migration scenarios to provide an upgrade path.
If you are looking for an upgrade path, please don't just blindly run this against your database without understanding what you're doing (table names will likely differ). Also, make sure you have a tested and working backup.
Comments
Comment #1
rooby commentedYeah, something like that should be ok.
Although don't use the above script if you don't want all the locations on your site moved.
That is certainly specific to your needs.
You should be able to create some sort of location_convert module that has settings so people could select what they want to convert to what based on node type, cck field or whatever.
I would say it would be an external module though and not part of the location module itself.
Comment #3
johnichiban commentedUpdated procedure to work with multiple locations per node. I converted all node locations into a CCK location field shared across all content types.
1. Enable CCK location
2. Create Location field called 'location'
3. Add this new location field to all content types
4. Execute code below (I created a page with php filter enabled and pasted in there)
5. Disable node location module
seems to be work so far...