Converting from Links Package module of Drupal 6 to CCK Links in Drupal 7

Converting from Links Package to CCK Links - Links package is a contributed module of drupal which was fairly good with lot of features. However there is no version for this in Drupal 7When I had to upgrade my websites from Drupal 6 to Drupal 7 , I was stuck because I did not find any solution on to convert from Links Package to CCK Links. I am sharing how I went about porting the nodes from Links package to CCK Links.

1. Upgraded the website normally from Drupal 6 to Drupal 7

2. Installed CCK , Links modules. 

3. Created a content type Weblink using Link as one of the fields. Ensure if you are using Taxonomy terms , you should not forget to add that as one of the fields in the new type. 


Then I manually added some nodes in the new content type to see how the database tables are getting populated. 


Next I ran two SQL Queries in my MYSQL database which did the trick. 


INSERT INTO `<database-name>`.`field_data_field_weblink` (`entity_type`, `bundle`, `deleted`, `entity_id`, `revision_id`, `language`, `delta`, `field_weblink_url`, `field_weblink_title`, `field_weblink_attributes`) 

select 'node', 'link', '0', ln.nid, ln.nid, 'und', '0', l.url, l.link_title, 'a:0:{}' from links l, links_node ln

where l.lid = ln.lid


UPDATE  `node` SET  `type` =  'links' WHERE TYPE =  'weblinks'


Obviously this will work only if 


1. You name your new content type as "Links"

2. Field type link should be named as "weblink" so that the machine name would appear as 'field_weblink'


Needless to say that you will lose some of the functionality of Links Package, but your content would be safe and migrated to Drupal 7. 


Hope you linked this and it works for you