16

What is the best way to upgrade a site from EE1 to EE2 that is using nGen file field with no EE2 equivalent. This site is also using nGen file inside of Matrix Fields.

33

The best way to do this is to proceed carefully and make backups of your database at each step of the way. I have previously written a blog post on this, but will elaborate further.

Step 1: Before running your upgrade change all ngen field types to text, don't worry the data won't be lost.

Step 2: Next upgrade ExpressionEngine as per the official docs and then go back into each field and and change them to the first party file type.

The next step involves a little bit of database manipulation, but it's just copy and paste so don't worry.

Step 3: Do make a back up of your database before you proceed just in case.

Step 4: This next step depends whether your original nGen file field was in a standard Channel Field, or a Matrix Field.

Now go into your database and 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.

(To find your upload preference ID in your control panel, go to Content > Files > File Upload Preferences. Choose the ID column on the left that matches the file upload location.)

4a: If updating standard Channel Fields, use this 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_%'

4b: For matrix fields run this 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_%'

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

Credit to Brandon Kelly and Rob Sanchez.

Additionally the same procedure can be used for other add-ons that don't exist in EE2. Convert to text before upgrade and then convert to a new equivalent field type post upgrade if needed.

  • Asking a question just to answer it yourself 5 minutes later is not the best way to start out the beta site. Write a blog article if you want to offer advice on a technique, use this site for actual questions. – kmgdev Nov 15 '12 at 19:57
  • kgrote, sure, thought I was helping out here. Will keep that in mind for future questions. – CreateSean Nov 15 '12 at 19:58
  • 1
    It might not be the best way to start the beta site, but it's certainly encouraged on Stack Exchange as a way to share knowledge (not everyone has a blog), as long as it's phrased as a legitimate question and answer. – Adrian Macneil Nov 16 '12 at 4:58
  • 1
    Just completed this process. These instructions very helpful. – auntialias Nov 20 '12 at 6:45
  • 1
    I'm just reading around the SE questions to get caught up and I saw this one. I just wanted to mention that SE encourages answering your own questions, just with specific parameters. (Source) – Erik Reagan Dec 2 '12 at 14:55
14

I asked this same question for a recent EE upgrade. The answer is on Stack Overflow:

https://stackoverflow.com/questions/13041491/expressionengine-1-to-expressionengine-2-upgrade-with-ngen-file-field

The EE2 equivalent field is Safecracker File. Worked perfectly for my upgrade.

6

I did a lot of different trials trying different methods. In the end no single method is perfect. I've found the thread Brad suggested very useful before.

Whatever method you try, make sure to backup everything twice. What I initially did was create two separate test DBs (one being a copy of the EE1 DB and a separate new EE2 DB) just to test out before the "production" run. Had errors the first couple of tries and then when I was satisfied did the live run.

  • sage advice: backup everything first. (I have a site to upgrade, will be testing all the advice given in this thread. Yours is the best first first step. Will try the others, of course.) – auntialias Nov 15 '12 at 22:34
4

Take a look at this, I was working on upgrading a EE1 (220+ weblog) instance to EE2 a while back, I shared some of it here: http://expressionengine.com/forums/viewthread/203380/#952561

  • Just realized you chimed in on that thread so it might not be helpful since you already saw it. – Brad Nov 15 '12 at 19:36
  • I posted and answered my own question - thought it would be helpful for the community. i just did this upgrade 3 days ago on a site with structure, multiple ngen file fields and multipl matrix with ngen. fun times. – CreateSean Nov 15 '12 at 19:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.