Covering OroCRM topics, including community updates and company announcements.  Subscribe

Forums Forums OroPlatform OroPlatform – How do I? Questions How create migration with exist data?

This topic contains 1 reply, has 2 voices, and was last updated by  andesk 2 years, 5 months ago.

  • Creator
  • #30354



    I have a table order with such info id, name, email, order_id etc.

    I want create new table user and transfer name, email data from order table

    and create connection oneToMany (user -> order) and add new coluumn to order table user_id

    I wrote migration script for a new table

    But I can’t find information how to correct get data fromn exits table and insert into new and in table order add FK(user_id).

    I used this doc

    Thank you.

Viewing 1 replies (of 1 total)
  • Author
  • #30355


    As you have access to the QueryBag in the up() method, you should be easily able to just add a Query to it.

    I checked existing Migrations doing this in OroPlatform itself and found the Migration class Oro\Bundle\UserBundle\Migrations\Schema\v1_5\SetOwnerForEmailTemplates.php, maybe take a look how it is done there?

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.