Search code examples
expressionengine

ExpressionEngine 1 to ExpressionEngine 2 Upgrade with nGen File Field


I'm about to do an ExpressionEngine v1 to ExpressionEngine v2 Upgrade with lots of data stored in nGen File Fields.

What are the steps I need to take pre and post upgrade to get this data working correctly with the EE2 SafeCracker File field?


Solution

  • After upgrading to EE2, find each ex-nGen File field and change its Field Type to File, and run this SQL query:

    UPDATE exp_channel_data
    SET field_id_X = CONCAT('{filedir_Y}', field_id_X)
    WHERE field_id_X != ''
    AND field_id_X NOT LIKE '{filedir_%'
    

    Replace “X” with your File field’s ID (you can get that from exp_channel_fields), and Y with the upload preference ID that nGen File Field was set to.

    If you had Matrix installed in EE1, upgrade to Matrix 2/EE2 and do the same for any ex-nGen File columns, using this SQL query instead:

    UPDATE exp_matrix_data
    SET col_id_X = CONCAT('{filedir_Y}', col_id_X)
    WHERE col_id_X != ''
    AND col_id_X NOT LIKE '{filedir_%'
    

    Again, X == your Matrix column ID (you can get that from exp_matrix_cols), and Y == your upload preference ID.

    (Credit goes to Rob Sanchez, of course.)