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

quicksketch’s picture

Sounds like you just need to SELECT * FROM the signup table and insert it into the flag_content table.

altparty’s picture

Thank you for the quick response.
But what to do with the flag_counts table?

quicksketch’s picture

After 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.

altparty’s picture

OK, just did a test and everything seemed to work fine. I will post the exact SQL queries later.

altparty’s picture

Here 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.

mooffie’s picture

Status:Active» Closed (fixed)

Martin, 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.)