OroPlatform Forums

Covering OroPlatform topics, including community updates and company announcements.

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 5 years, 3 months ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
  • #36007



    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 https://github.com/orocrm/platform/tree/master/src/Oro/Bundle/MigrationBundle

    Thank you.

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


    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)

The forum ‘OroPlatform – How do I? Questions’ is closed to new topics and replies.

You will be redirected to [title]. Would you like to continue?

Yes No