Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I want to replace the Signup module by the Flag module. But with huge Signup data I need to have some migration script or import script for flags.
Data that comes from the SIgnup module are: nid, uid and signup_time.
Can anyone help me?
Comments
Comment #1
quicksketchSounds like you just need to SELECT * FROM the signup table and insert it into the flag_content table.
Comment #2
altparty CreditAttribution: altparty commentedThank you for the quick response.
But what to do with the flag_counts table?
Comment #3
quicksketchAfter you insert all the records into the flag_content table, SELECT COUNT(*) from the flag_content table and insert/update the record in the flag_counts table.
Comment #4
altparty CreditAttribution: altparty commentedOK, just did a test and everything seemed to work fine. I will post the exact SQL queries later.
Comment #5
altparty CreditAttribution: altparty commentedHere are the steps I used.
First of all: backup your database before you start.
I used phpMyAdmin to export signup_log table as CSV,
Open the CSV file with a spreadsheet program, like MS-Excel or OpenOffice Calc.
Move the columns around aligned with the sort order of the flag_content table.
fcid: increment each row by one
fid: flag id from flags table
content_type: node
content_id: nid from the signup_log table
uid: uid from the signup_log table
sid: 0
timestamp: signup_time from the signup_log table
Find the flag_content table in phpMyAdmin and select import as CSV.
Next:
SELECT * , COUNT( * )
FROM `flag_content`
GROUP BY `content_id`
and select export as CSV.
Open the CSV file with a spreadsheet program, like MS-Excel or OpenOffice Calc.
Move the columns around aligned with the sort order of the flag_counts table
fid: flag id from flags table
content_type: node
content_id: nid
count: count
Save as a CSV file
Find the flag_counts table and import the CSV file.
That's it.
Comment #6
mooffie CreditAttribution: mooffie commentedMartin, thanks. I'm closing this. I linked to this issue from a new handbook page, Migrating from other modules.
(We should have a command --a drush one or whatever-- that rebuilds the {flag_counts} table.)