This topic contains 1 reply, has 2 voices, and was last updated by Yurii Muratov 6 years ago.
- Topic
I have write some migration here is the code :
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101<?php/*** Created by PhpStorm.* User: adrien* Date: 21/02/18* Time: 22:35*/namespace Sinabs\Bundle\VoipBundle\Migrations\Schema\v1_0;use Doctrine\DBAL\Schema\Schema;use Oro\Bundle\EntityExtendBundle\Migration\Extension\ExtendExtension;use Oro\Bundle\EntityExtendBundle\Migration\Extension\ExtendExtensionAwareInterface;use Oro\Bundle\EntityExtendBundle\EntityConfig\ExtendScope;use Oro\Bundle\EntityBundle\EntityConfig\DatagridScope;use Oro\Bundle\MigrationBundle\Migration\Migration;use Oro\Bundle\MigrationBundle\Migration\QueryBag;class SinabsVoipBundle implements Migration, ExtendExtensionAwareInterface{protected $extendExtension;public function setExtendExtension(ExtendExtension $extendExtension){$this->extendExtension = $extendExtension;}public function up(Schema $schema, QueryBag $queries){$this->extendExtension->addManyToManyRelation($schema, 'sinabs_voip', // owning side table'users', // owning side field name'oro_user', // inverse side table['username'], // column names are used to show a title of related entity['username'], // column names are used to show detailed info about related entity['username'], // Column names are used to show related entity in a grid['extend' => ['owner' => ExtendScope::OWNER_CUSTOM]]);$this->extendExtension->addManyToManyInverseRelation($schema, 'sinabs_voip', // owning side table'users', // owning side field name'oro_user', // inverse side table'voips', // inverse side field name['phone'], // column names are used to show a title of owning side entity['phone'], // column names are used to show detailed info about owning side entity['phone'], // Column names are used to show owning side entity in a grid['extend' => ['owner' => ExtendScope::OWNER_CUSTOM]]);$this->extendExtension->addManyToOneRelation($schema, 'orocrm_call', // owning side table'voip', // owning side field name'sinabs_voip', // inverse side table'phone', // column name is used to show related entity['extend' => ['is_extend' => true,'owner' => ExtendScope::OWNER_CUSTOM,'without_default' => true,'on_delete' => 'SET NULL',],'form' => ['is_enabled' => false],'view' => ['is_displayable' => false]]);$this->extendExtension->addManyToOneInverseRelation($schema, 'orocrm_call', // owning side table'voip', // owning side field name'sinabs_voip', // inverse side table'calls', // inverse side field name['id'], // column names are used to show a title of owning side entity['id'], // column names are used to show detailed info about owning side entity['id'], // Column names are used to show owning side entity in a grid['extend' => ['is_extend' => true,'owner' => ExtendScope::OWNER_CUSTOM,'without_default' => true,'on_delete' => 'SET NULL',],'form' => ['is_enabled' => false],'view' => ['is_displayable' => false]]);$table = $schema->getTable('orocrm_call');$table->addColumn('callId','string',['oro_options' => ['extend' => ['owner' => ExtendScope::OWNER_CUSTOM, 'unique' => true],'datagrid' => ['is_visible' => DatagridScope::IS_VISIBLE_FALSE],'merge' => ['display' => false],]]);$table->addUniqueIndex(['callId'], 'oro_idx_call_id');}}I run oro:migration:load and all is OK but when I run then doctrine:schema:update it remove my index :
1234DROP INDEX oro_idx_call_id ON orocrm_call;DROP INDEX oro_idx_call_callid ON orocrm_call;I want the changes made by migration to be persistent, what is the problem. Is this a bug ? I have already encounter this problem see related topics https://oroinc.com/orocrm/forums/topic/bug-in-command-orocronimap-sync-add-path-migration-not-loaded
The forum ‘OroPlatform – Installation/Technical Issues or Problems’ is closed to new topics and replies.