Download & Extend

Migrate from Signup to Flag

Project:Flag
Version:6.x-1.3
Component:Flag core
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

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

#1

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

#2

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

#3

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.

#4

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

#5

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.

#6

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

nobody click here