This topic contains 1 reply, has 2 voices, and was last updated by andesk 8 years, 10 months ago.
- Topic
Hello,
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
1234567891011121314151617181920212223242526272829303132class TestMigration implements Migration, RenameExtensionAwareInterface{/*** Modifies the given schema to apply necessary changes of a database* The given query bag can be used to apply additional SQL queries before and after schema changes** @param Schema $schema* @param QueryBag $queries* @return void*/public function up(Schema $schema, QueryBag $queries){$table = $schema->createTable('user');$table->addColumn('id', 'integer', ['autoincrement' => true]);$table->addColumn('name', 'string', ['length' => 65]);$table->addColumn('email', 'string', ['notnull' => false, 'length' => 129]);$table->addColumn('createdAt', 'datetime');$table->setPrimaryKey(['id']);}/*** Sets the RenameExtension** @param RenameExtension $renameExtension*/public function setRenameExtension(RenameExtension $renameExtension){// TODO: Implement setRenameExtension() method.}}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.
The forum ‘OroPlatform – How do I? Questions’ is closed to new topics and replies.