simon_at_evolutednet - 3 weeks ago

Is there a way to make an existing field translatable without messing with past migrations and re-running everything?

Answer

simon_at_evolutednet - 2 weeks ago

While trying to do this I noticed that when I was trying to update the tables and set the translatable flag on the assignment, it was running into errors with non-existant fields. Looks like setting the assignment to translatable using $assignment->setTranslatable() actually modifies the table and copies the data across to the translations table and I was trying to duplicate the actions.

Looks like setting translatable on the assignment actually does what I wanted. I'm sure I tried this the other day but must have missed something.

ryanthompson - 3 weeks ago

Toggling translations (letting Pyro handle it automatically) is not something currently supported though it's on my list of todos. It get's complicated with retaining data and large datasets.

I would write new migrations to stash the data (maybe in cache), un-assign the field, re-assign the field, then insert the data again.

You could also just manually create the fields you need on the translations table, do the data migration, then mark the assignment as translatable for posterity within the CMS. That might be cleaner.

simon_at_evolutednet - 2 weeks ago

While trying to do this I noticed that when I was trying to update the tables and set the translatable flag on the assignment, it was running into errors with non-existant fields. Looks like setting the assignment to translatable using $assignment->setTranslatable() actually modifies the table and copies the data across to the translations table and I was trying to duplicate the actions.

Looks like setting translatable on the assignment actually does what I wanted. I'm sure I tried this the other day but must have missed something.