/**
  * {@inheritdoc}
  */
 public function up(Schema $schema, QueryBag $queries)
 {
     $queries->addQuery(new UpdateEntityConfigEntityValueQuery('Oro\\Bundle\\WorkflowBundle\\Entity\\WorkflowDefinition', 'entity', 'label', 'oro.workflow.workflowdefinition.entity_label'));
     $queries->addQuery(new UpdateEntityConfigEntityValueQuery('Oro\\Bundle\\WorkflowBundle\\Entity\\WorkflowDefinition', 'entity', 'plural_label', 'oro.workflow.workflowdefinition.entity_plural_label'));
     $queries->addQuery(new UpdateEntityConfigEntityValueQuery('Oro\\Bundle\\WorkflowBundle\\Entity\\ProcessDefinition', 'entity', 'label', 'oro.workflow.processdefinition.entity_label'));
     $queries->addQuery(new UpdateEntityConfigEntityValueQuery('Oro\\Bundle\\WorkflowBundle\\Entity\\ProcessDefinition', 'entity', 'plural_label', 'oro.workflow.processdefinition.entity_label'));
 }
 public function down(Schema $schema, QueryBag $queries)
 {
     $queries->addQuery("DROP TABLE c_notebook");
     $queries->addQuery("DROP TABLE c_notebook_audit");
     /*$this->addSql('CREATE TABLE oro_migrations (id INT AUTO_INCREMENT NOT NULL, bundle VARCHAR(250) NOT NULL, version VARCHAR(250) NOT NULL, loaded_at DATETIME NOT NULL, INDEX idx_oro_migrations (bundle), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
       $this->addSql('CREATE TABLE oro_migrations_data (id INT AUTO_INCREMENT NOT NULL, class_name VARCHAR(255) NOT NULL, loaded_at DATETIME NOT NULL, version VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
       $this->addSql('CREATE TABLE sylius_settings_parameter (id INT AUTO_INCREMENT NOT NULL, namespace VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, value LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:object)\', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
       $this->addSql('DROP TABLE c_item_visibility');
       $this->addSql('DROP TABLE c_item');
       $this->addSql('ALTER TABLE c_item_property DROP PRIMARY KEY');
       $this->addSql('ALTER TABLE c_item_property ADD iid INT AUTO_INCREMENT NOT NULL, ADD tool VARCHAR(100) NOT NULL, ADD visibility TINYINT(1) NOT NULL, ADD start_visible DATETIME DEFAULT NULL, ADD end_visible DATETIME DEFAULT NULL, CHANGE id id INT NOT NULL, CHANGE item_id ref INT NOT NULL');
       $this->addSql('CREATE INDEX idx_item_property_toolref ON c_item_property (tool, ref)');
       $this->addSql('CREATE INDEX idx_item_property_tooliuid ON c_item_property (tool, insert_user_id)');
       $this->addSql('ALTER TABLE c_item_property ADD PRIMARY KEY (iid)');
       $this->addSql('ALTER TABLE c_notebook DROP FOREIGN KEY FK_E7EE1CE0A76ED395');
       $this->addSql('ALTER TABLE c_notebook DROP FOREIGN KEY FK_E7EE1CE091D79BD3');
       $this->addSql('DROP INDEX IDX_E7EE1CE0A76ED395 ON c_notebook');
       $this->addSql('DROP INDEX IDX_E7EE1CE091D79BD3 ON c_notebook');
       $this->addSql('ALTER TABLE c_notebook DROP PRIMARY KEY');
       $this->addSql('ALTER TABLE c_notebook ADD notebook_id INT NOT NULL, ADD course VARCHAR(40) NOT NULL, CHANGE id iid INT AUTO_INCREMENT NOT NULL');
       $this->addSql('ALTER TABLE c_notebook ADD PRIMARY KEY (iid)');
       $this->addSql('ALTER TABLE c_notebook_audit DROP PRIMARY KEY');
       $this->addSql('ALTER TABLE c_notebook_audit ADD notebook_id INT DEFAULT NULL, ADD course VARCHAR(40) DEFAULT NULL, CHANGE id iid INT NOT NULL');
       $this->addSql('ALTER TABLE c_notebook_audit ADD PRIMARY KEY (iid, rev)');
       $this->addSql('ALTER TABLE media__media CHANGE content_type content_type VARCHAR(64) DEFAULT NULL');
       $this->addSql('ALTER TABLE media__media_audit CHANGE content_type content_type VARCHAR(64) DEFAULT NULL');
       $this->addSql('ALTER TABLE settings_current ADD namespace VARCHAR(255) NOT NULL, ADD name VARCHAR(255) NOT NULL');*/
 }
 /**
  * @inheritdoc
  */
 public function up(Schema $schema, QueryBag $queries)
 {
     if ($schema instanceof ExtendSchema) {
         $queries->addQuery(new UpdateExtendConfigMigrationQuery($schema->getExtendOptions(), $this->commandExecutor, $this->configProcessorOptionsPath));
         $queries->addQuery(new RefreshExtendCacheMigrationQuery($this->commandExecutor));
     }
 }
 /**
  * {@inheritdoc}
  */
 public function up(Schema $schema, QueryBag $queries)
 {
     foreach ($this->getFieldsParamsForUpdate() as $field) {
         $queries->addQuery(new UpdateEntityConfigFieldValueQuery($field['entityName'], $field['field'], 'entity', 'label', $field['value'], $field['replace']));
         $queries->addQuery(new UpdateEntityConfigIndexFieldValueQuery($field['entityName'], $field['field'], 'entity', 'label', $field['value'], $field['replace']));
     }
 }
Exemple #5
0
 /**
  * {@inheritdoc}
  */
 public function up(Schema $schema, QueryBag $queries)
 {
     if ($schema->hasTable('oro_process_definition')) {
         $queries->addQuery(new ParametrizedSqlMigrationQuery('DELETE FROM oro_process_definition WHERE name = :name', ['name' => 'email_auto_response']));
         $queries->addQuery(new ParametrizedSqlMigrationQuery('DELETE FROM oro_process_trigger WHERE definition_name = :name', ['name' => 'email_auto_response']));
     }
 }
 /**
  * {@inheritdoc}
  */
 public function up(Schema $schema, QueryBag $queries)
 {
     $fields = [['entityName' => 'OroCRM\\Bundle\\SalesBundle\\Entity\\Lead', 'field' => 'createdAt', 'value' => 'oro.ui.created_at', 'replace' => 'orocrm.sales.lead.created_at.label'], ['entityName' => 'OroCRM\\Bundle\\SalesBundle\\Entity\\Lead', 'field' => 'updatedAt', 'value' => 'oro.ui.updated_at', 'replace' => 'orocrm.sales.lead.updated_at.label'], ['entityName' => 'OroCRM\\Bundle\\SalesBundle\\Entity\\Opportunity', 'field' => 'createdAt', 'value' => 'oro.ui.created_at', 'replace' => 'orocrm.sales.opportunity.created_at.label'], ['entityName' => 'OroCRM\\Bundle\\SalesBundle\\Entity\\Opportunity', 'field' => 'updatedAt', 'value' => 'oro.ui.updated_at', 'replace' => 'orocrm.sales.opportunity.updated_at.label'], ['entityName' => 'OroCRM\\Bundle\\SalesBundle\\Entity\\SalesFunnel', 'field' => 'createdAt', 'value' => 'oro.ui.created_at', 'replace' => 'orocrm.sales.salesfunnel.created_at.label'], ['entityName' => 'OroCRM\\Bundle\\SalesBundle\\Entity\\SalesFunnel', 'field' => 'updatedAt', 'value' => 'oro.ui.updated_at', 'replace' => 'orocrm.sales.salesfunnel.updated_at.label']];
     foreach ($fields as $field) {
         $queries->addQuery(new UpdateEntityConfigFieldValueQuery($field['entityName'], $field['field'], 'entity', 'label', $field['value'], $field['replace']));
         $queries->addQuery(new UpdateEntityConfigIndexFieldValueQuery($field['entityName'], $field['field'], 'entity', 'label', $field['value'], $field['replace']));
     }
 }
 /**
  * {@inheritdoc}
  */
 public function up(Schema $schema, QueryBag $queries)
 {
     $fields = [['entityName' => 'Oro\\Bundle\\EmbeddedFormBundle\\Entity\\EmbeddedForm', 'field' => 'createdAt', 'value' => 'oro.ui.created_at', 'replace' => 'oro.embeddedform.created_at.label'], ['entityName' => 'Oro\\Bundle\\EmbeddedFormBundle\\Entity\\EmbeddedForm', 'field' => 'updatedAt', 'value' => 'oro.ui.updated_at', 'replace' => 'oro.embeddedform.updated_at.label']];
     foreach ($fields as $field) {
         $queries->addQuery(new UpdateEntityConfigFieldValueQuery($field['entityName'], $field['field'], 'entity', 'label', $field['value'], $field['replace']));
         $queries->addQuery(new UpdateEntityConfigIndexFieldValueQuery($field['entityName'], $field['field'], 'entity', 'label', $field['value'], $field['replace']));
     }
 }
 /**
  * {@inheritdoc}
  */
 public function up(Schema $schema, QueryBag $queries)
 {
     $fields = [['entityName' => 'OroCRM\\Bundle\\ContactBundle\\Entity\\Contact', 'field' => 'createdAt', 'value' => 'oro.ui.created_at', 'replace' => 'orocrm.contact.created_at.label'], ['entityName' => 'OroCRM\\Bundle\\ContactBundle\\Entity\\Contact', 'field' => 'updatedAt', 'value' => 'oro.ui.updated_at', 'replace' => 'orocrm.contact.updated_at.label'], ['entityName' => 'OroCRM\\Bundle\\ContactBundle\\Entity\\ContactAddress', 'field' => 'created', 'value' => 'oro.ui.created_at', 'replace' => 'orocrm.contact.contactaddress.created.label'], ['entityName' => 'OroCRM\\Bundle\\ContactBundle\\Entity\\ContactAddress', 'field' => 'updated', 'value' => 'oro.ui.updated_at', 'replace' => 'orocrm.contact.contactaddress.updated.label']];
     foreach ($fields as $field) {
         $queries->addQuery(new UpdateEntityConfigFieldValueQuery($field['entityName'], $field['field'], 'entity', 'label', $field['value'], $field['replace']));
         $queries->addQuery(new UpdateEntityConfigIndexFieldValueQuery($field['entityName'], $field['field'], 'entity', 'label', $field['value'], $field['replace']));
     }
 }
 /**
  * {@inheritdoc}
  */
 public function up(Schema $schema, QueryBag $queries)
 {
     $this->configManager->flushAllCaches();
     if ($schema instanceof ExtendSchema) {
         $queries->addQuery(new RefreshExtendConfigMigrationQuery($this->commandExecutor, $this->dataStorageExtension->get('initial_entity_config_state', []), $this->initialEntityConfigStatePath));
         $queries->addQuery(new RefreshExtendCacheMigrationQuery($this->commandExecutor));
     }
 }
 /**
  * {@inheritdoc}
  */
 public function up(Schema $schema, QueryBag $queries)
 {
     $fields = [['entityName' => 'Oro\\Bundle\\WorkflowBundle\\Entity\\WorkflowDefinition', 'field' => 'createdAt', 'value' => 'oro.ui.created_at', 'replace' => 'oro.workflow.workflowdefinition.created_at.label'], ['entityName' => 'Oro\\Bundle\\WorkflowBundle\\Entity\\WorkflowDefinition', 'field' => 'updatedAt', 'value' => 'oro.ui.updated_at', 'replace' => 'oro.workflow.workflowdefinition.updated_at.label'], ['entityName' => 'Oro\\Bundle\\WorkflowBundle\\Entity\\WorkflowItem', 'field' => 'created', 'value' => 'oro.ui.created_at', 'replace' => 'oro.workflow.workflowitem.created.label'], ['entityName' => 'Oro\\Bundle\\WorkflowBundle\\Entity\\WorkflowItem', 'field' => 'updated', 'value' => 'oro.ui.updated_at', 'replace' => 'oro.workflow.workflowitem.updated.label']];
     foreach ($fields as $field) {
         $queries->addQuery(new UpdateEntityConfigFieldValueQuery($field['entityName'], $field['field'], 'entity', 'label', $field['value'], $field['replace']));
         $queries->addQuery(new UpdateEntityConfigIndexFieldValueQuery($field['entityName'], $field['field'], 'entity', 'label', $field['value'], $field['replace']));
     }
 }
Exemple #11
0
 /**
  * {@inheritdoc}
  */
 public function up(Schema $schema, QueryBag $queries)
 {
     self::addOrganization($schema);
     //Add organization fields to ownership entity config
     $queries->addQuery(new UpdateOwnershipTypeQuery('OroCRM\\Bundle\\ContactBundle\\Entity\\Contact', ['organization_field_name' => 'organization', 'organization_column_name' => 'organization_id']));
     //Add organization fields to ownership entity config
     $queries->addQuery(new UpdateOwnershipTypeQuery('OroCRM\\Bundle\\ContactBundle\\Entity\\Group', ['organization_field_name' => 'organization', 'organization_column_name' => 'organization_id']));
 }
 /**
  * {@inheritdoc}
  */
 public function up(Schema $schema, QueryBag $queries)
 {
     if ($schema instanceof ExtendSchema) {
         $queries->addQuery(new UpdateExtendConfigMigrationQuery($schema->getExtendOptions(), $this->commandExecutor, $this->configProcessorOptionsPath));
         $queries->addQuery(new RefreshExtendConfigMigrationQuery($this->commandExecutor, $this->dataStorageExtension->get('initial_entity_config_state', []), $this->initialEntityConfigStatePath));
         $queries->addQuery(new RefreshExtendCacheMigrationQuery($this->commandExecutor));
     }
 }
Exemple #13
0
 /**
  * {@inheritdoc}
  */
 public function up(Schema $schema, QueryBag $queries)
 {
     self::addOrganization($schema, 'orocrm_campaign');
     self::addOrganization($schema, 'orocrm_campaign_email');
     //Add organization fields to ownership entity config
     $queries->addQuery(new UpdateOwnershipTypeQuery('OroCRM\\Bundle\\CampaignBundle\\Entity\\Campaign', ['organization_field_name' => 'organization', 'organization_column_name' => 'organization_id']));
     $queries->addQuery(new UpdateOwnershipTypeQuery('OroCRM\\Bundle\\CampaignBundle\\Entity\\EmailCampaign', ['organization_field_name' => 'organization', 'organization_column_name' => 'organization_id']));
 }
 /**
  * {@inheritdoc}
  */
 public function up(Schema $schema, QueryBag $queries)
 {
     $queries->addQuery(new DropUnusedEntityConfigFieldValuesQuery());
     $fields = [['entityName' => 'Oro\\Bundle\\OrganizationBundle\\Entity\\BusinessUnit', 'field' => 'createdAt', 'value' => 'oro.ui.created_at', 'replace' => 'oro.organization.businessunit.created_at.label'], ['entityName' => 'Oro\\Bundle\\OrganizationBundle\\Entity\\BusinessUnit', 'field' => 'updatedAt', 'value' => 'oro.ui.updated_at', 'replace' => 'oro.organization.businessunit.updated_at.label']];
     foreach ($fields as $field) {
         $queries->addQuery(new UpdateEntityConfigFieldValueQuery($field['entityName'], $field['field'], 'entity', 'label', $field['value'], $field['replace']));
         $queries->addQuery(new UpdateEntityConfigIndexFieldValueQuery($field['entityName'], $field['field'], 'entity', 'label', $field['value'], $field['replace']));
     }
 }
Exemple #15
0
 /**
  * {@inheritdoc}
  */
 public function up(Schema $schema, QueryBag $queries)
 {
     self::addOrganization($schema);
     //Add organization fields to ownership entity config
     $queries->addQuery(new UpdateOwnershipTypeQuery('OroCRM\\Bundle\\SalesBundle\\Entity\\Lead', ['organization_field_name' => 'organization', 'organization_column_name' => 'organization_id']));
     //Add organization fields to ownership entity config
     $queries->addQuery(new UpdateOwnershipTypeQuery('OroCRM\\Bundle\\SalesBundle\\Entity\\Opportunity', ['organization_field_name' => 'organization', 'organization_column_name' => 'organization_id']));
     //Add organization fields to ownership entity config
     $queries->addQuery(new UpdateOwnershipTypeQuery('OroCRM\\Bundle\\SalesBundle\\Entity\\B2bCustomer', ['organization_field_name' => 'organization', 'organization_column_name' => 'organization_id']));
 }
Exemple #16
0
 /**
  * @param Schema   $schema
  * @param QueryBag $queries
  */
 public static function updateMailboxName(Schema $schema, QueryBag $queries)
 {
     $table = $schema->getTable('oro_email_origin');
     $sql = 'UPDATE oro_email_origin SET mailbox_name = %s WHERE name = :name';
     $queries->addQuery(new ParametrizedSqlMigrationQuery(sprintf($sql, "'" . InternalEmailOrigin::MAILBOX_NAME . "'"), ['name' => 'internalemailorigin'], ['name' => Type::STRING]));
     if ($table->hasColumn('imap_user')) {
         $queries->addQuery(new ParametrizedSqlMigrationQuery(sprintf($sql, 'imap_user'), ['name' => 'imapemailorigin'], ['name' => Type::STRING]));
         $queries->addQuery(new ParametrizedSqlMigrationQuery(sprintf($sql, 'imap_user'), ['name' => 'useremailorigin'], ['name' => Type::STRING]));
     }
     if ($table->hasColumn('ews_user_email')) {
         $queries->addQuery(new ParametrizedSqlMigrationQuery(sprintf($sql, 'ews_user_email'), ['name' => 'ewsemailorigin'], ['name' => Type::STRING]));
     }
 }
 /**
  * @param Schema $schema
  * @param QueryBag $queries
  */
 public function down(Schema $schema, QueryBag $queries)
 {
     $queries->addQuery('ALTER TABLE access_url DROP limit_courses, DROP limit_active_courses, DROP limit_sessions, DROP limit_users, DROP limit_teachers, DROP limit_disk_space, DROP email');
     $queries->addQuery('ALTER TABLE c_student_publication DROP filesize');
     $queries->addQuery('ALTER TABLE access_url_rel_session MODIFY id INT NOT NULL');
     $queries->addQuery('ALTER TABLE access_url_rel_session DROP FOREIGN KEY FK_6CBA5F5D613FECDF');
     $queries->addQuery('ALTER TABLE access_url_rel_session DROP FOREIGN KEY FK_6CBA5F5D73444FD5');
     $queries->addQuery('DROP INDEX IDX_6CBA5F5D613FECDF ON access_url_rel_session');
     $queries->addQuery('DROP INDEX IDX_6CBA5F5D73444FD5 ON access_url_rel_session');
     $queries->addQuery('ALTER TABLE access_url_rel_session DROP PRIMARY KEY');
     $queries->addQuery('ALTER TABLE access_url_rel_session DROP id, CHANGE session_id session_id INT NOT NULL, CHANGE access_url_id access_url_id INT NOT NULL');
     $queries->addQuery('DROP TABLE c_group_info_audit');
 }
 /**
  * @param Schema $schema
  * @param QueryBag $queries
  */
 public function up(Schema $schema, QueryBag $queries)
 {
     $table = $schema->getTable('course_rel_class');
     if (!$table->hasColumn('c_id')) {
         $queries->addQuery("ALTER TABLE course_rel_class ADD c_id int NOT NULL");
     }
     if ($table->hasColumn('course_code')) {
         $queries->addQuery("\n                UPDATE course_rel_class cc\n                SET cc.c_id = (SELECT id FROM course WHERE code = cc.course_code)\n            ");
         $queries->addQuery("ALTER TABLE course_rel_class DROP course_code");
         $queries->addQuery("ALTER TABLE course_rel_class MODIFY COLUMN class_id INT DEFAULT NULL");
         $queries->addQuery("ALTER TABLE course_rel_class DROP PRIMARY KEY");
         $queries->addQuery("ALTER TABLE course_rel_class ADD PRIMARY KEY (class_id, c_id)");
         $queries->addQuery("\n              ALTER TABLE course_rel_class ADD FOREIGN KEY (c_id) REFERENCES course (id) ON DELETE RESTRICT\n            ");
     }
     $tables = ['gradebook_category', 'gradebook_evaluation', 'gradebook_link', 'search_engine_ref', 'shared_survey', 'specific_field_values', 'templates', 'track_e_attempt'];
     foreach ($tables as $table) {
         $tableObj = $schema->getTable($table);
         if (!$tableObj->hasColumn('c_id')) {
             $queries->addQuery("ALTER TABLE {$table} ADD c_id int NOT NULL");
             if ($tableObj->hasColumn('course_code')) {
                 $queries->addQuery("\n                      UPDATE {$table} t\n                      SET t.c_id = (SELECT id FROM course WHERE code = t.course_code)\n                    ");
                 $queries->addQuery("ALTER TABLE {$table} DROP course_code");
             }
         }
         /*$queries->addQuery("
               ALTER TABLE $table ADD FOREIGN KEY (c_id) REFERENCES course (id) ON DELETE RESTRICT
           ");*/
     }
     /*
             $queries->addQuery("ALTER TABLE personal_agenda DROP course");
     
             $queries->addQuery("
                 ALTER TABLE specific_field_values
                 ADD c_id int(11) NOT NULL,
                 ADD FOREIGN KEY (c_id) REFERENCES course (id) ON DELETE RESTRICT;
             ");
     
             $queries->addQuery("
                 ALTER TABLE track_e_hotspot
                 CHANGE c_id c_id int(11) NOT NULL AFTER hotspot_course_code,
                 ADD FOREIGN KEY (c_id) REFERENCES course (id) ON DELETE RESTRICT;
             ");
             $queries->addQuery("
                 UPDATE track_e_hotspot teh
                 SET teh.c_id = (SELECT id FROM course WHERE code = teh.hotspot_course_code)
                 WHERE teh.hotspot_course_code != NULL OR hotspot_course_code != ''
             ");
             $queries->addQuery("ALTER TABLE personal_agenda DROP hotspot_course_code");*/
 }
 /**
  * @param Schema $schema
  */
 public function down(Schema $schema, QueryBag $queries)
 {
     $queries->addQuery("ALTER TABLE skill_rel_user DROP FOREIGN KEY FK_su_session");
     $queries->addQuery("ALTER TABLE skill_rel_user DROP FOREIGN KEY FK_su_course");
     $queries->addQuery("ALTER TABLE skill_rel_user DROP FOREIGN KEY FK_su_skill");
     $queries->addQuery("ALTER TABLE skill_rel_user DROP FOREIGN KEY FK_su_user");
     $queries->addQuery("DROP INDEX idx_select_s_c_u ON skill_rel_user");
     $queries->addQuery("DROP INDEX idx_select_sk_u ON skill_rel_user");
     $queries->addQuery("ALTER TABLE skill_rel_user CHANGE session_id session_id INT NOT NULL");
     $queries->addQuery("UPDATE skill_rel_user SET course_id = 0 WHERE course_id IS NULL");
     $queries->addQuery("UPDATE skill_rel_user SET session_id = 0 WHERE session_id IS NULL");
 }
 public function up(Schema $schema, QueryBag $queries)
 {
     $sqls = $this->container->get('test_service')->getQueries();
     foreach ($sqls as $sql) {
         $queries->addQuery($sql);
     }
 }
 /**
  * {@inheritdoc}
  */
 public function up(Schema $schema, QueryBag $queries)
 {
     self::addOrganizationDashboardTable($schema);
     self::dropOroDashboardActiveTableIndexes($schema);
     //Add organization fields to ownership entity config
     $queries->addQuery(new UpdateOwnershipTypeQuery('Oro\\Bundle\\DashboardBundle\\Entity\\Dashboard', ['organization_field_name' => 'organization', 'organization_column_name' => 'organization_id']));
 }
 /**
  * {@inheritdoc}
  */
 public function up(Schema $schema, QueryBag $queries)
 {
     if (!$schema->hasTable('oro_process_trigger')) {
         return;
     }
     $queries->addQuery(new ParametrizedSqlMigrationQuery('DELETE FROM oro_process_trigger WHERE definition_name = :name', ['name' => 'convert_mailbox_email_to_case']));
 }
 /**
  * @inheritdoc
  */
 public function up(Schema $schema, QueryBag $queries)
 {
     $this->configManager->clearCache();
     $this->configManager->clearConfigurableCache();
     if ($schema instanceof ExtendSchema) {
         $queries->addQuery(new RefreshExtendCacheMigrationQuery($this->commandExecutor));
     }
 }
 /**
  * {@inheritdoc}
  */
 public function up(Schema $schema, QueryBag $queries)
 {
     $table = $schema->getTable('orocrm_marketing_list');
     $table->addColumn('organization_id', 'integer', ['notnull' => false]);
     $table->addIndex(['organization_id'], 'idx_3acc3ba32c8a3de', []);
     $table->addForeignKeyConstraint($schema->getTable('oro_organization'), ['organization_id'], ['id'], ['onUpdate' => null, 'onDelete' => 'SET NULL']);
     $queries->addQuery(new UpdateOwnershipTypeQuery('OroCRM\\Bundle\\SalesBundle\\Entity\\Lead', ['organization_field_name' => 'organization', 'organization_column_name' => 'organization_id']));
 }
 /**
  * {@inheritdoc}
  */
 public function up(Schema $schema, QueryBag $queries)
 {
     $table = $schema->getTable('oro_segment_snapshot');
     $table->addColumn('integer_entity_id', 'integer', ['notnull' => false]);
     $table->changeColumn('entity_id', ['notnull' => false]);
     $table->addIndex(['integer_entity_id'], 'sgmnt_snpsht_int_entity_idx');
     $table->addIndex(['entity_id'], 'sgmnt_snpsht_str_entity_idx');
     $queries->addQuery(new UpdateSegmentSnapshotDataQuery());
 }
 /**
  * @inheritdoc
  */
 public function up(Schema $schema, QueryBag $queries)
 {
     if ($schema->hasTable('oro_activity_list')) {
         $table = $schema->getTable('oro_activity_list');
         $table->addIndex(['related_activity_class'], 'tmp_al_related_activity_class');
         $table->addIndex(['related_activity_id'], 'tmp_al_related_activity_id');
         $queries->addQuery(new UpdateDateActivityListQuery());
     }
 }
Exemple #27
0
 /**
  * {@inheritdoc}
  */
 public function up(Schema $schema, QueryBag $queries)
 {
     $table = $schema->getTable('orocrm_campaign_email_stats');
     $table->addColumn('open_count', 'integer', ['notnull' => false]);
     $table->addColumn('click_count', 'integer', ['notnull' => false]);
     $table->addColumn('bounce_count', 'integer', ['notnull' => false]);
     $table->addColumn('abuse_count', 'integer', ['notnull' => false]);
     $table->addColumn('unsubscribe_count', 'integer', ['notnull' => false]);
     $queries->addQuery(new AggregateStatisticsQuery());
 }
 /**
  * @inheritdoc
  */
 public function up(Schema $schema, QueryBag $queries)
 {
     if (!empty($this->bundleVersions)) {
         $date = new \DateTime();
         foreach ($this->bundleVersions as $bundleName => $bundleVersion) {
             $sql = sprintf("INSERT INTO %s (bundle, version, loaded_at) VALUES ('%s', '%s', '%s')", CreateMigrationTableMigration::MIGRATION_TABLE, $bundleName, $bundleVersion, $date->format('Y-m-d H:i:s'));
             $queries->addQuery($sql);
         }
     }
 }
 /**
  * Makes sure oro_session table is up-to-date
  *
  * @param Schema   $schema
  * @param QueryBag $queries
  */
 public function oroSessionTable(Schema $schema, QueryBag $queries)
 {
     if (!$schema->hasTable('oro_session')) {
         $this->createOroSessionTable($schema);
     } else {
         $currentSchema = new Schema([clone $schema->getTable('oro_session')]);
         $requiredSchema = new Schema();
         $this->createOroSessionTable($requiredSchema);
         $comparator = new Comparator();
         $changes = $comparator->compare($currentSchema, $requiredSchema)->toSql($this->platform);
         if ($changes) {
             // force to recreate oro_session table as a result of dropTable/createTable pair
             // might be "ALTER TABLE" query rather than "DROP/CREATE" queries
             $dropTableSql = $comparator->compare($currentSchema, new Schema())->toSql($this->platform);
             $createTableSql = $comparator->compare(new Schema(), $requiredSchema)->toSql($this->platform);
             $queries->addQuery(new SqlMigrationQuery($dropTableSql));
             $queries->addQuery(new SqlMigrationQuery($createTableSql));
         }
     }
 }
Exemple #30
0
 /**
  * {@inheritdoc}
  */
 public function up(Schema $schema, QueryBag $queries)
 {
     $preSchema = clone $schema;
     $table = $preSchema->getTable('oro_cron_schedule');
     $table->changeColumn('command', ['length' => 255]);
     $table->addColumn('args', 'json_array', ['notnull' => false]);
     $table->addColumn('args_hash', 'string', ['notnull' => false, 'length' => 32]);
     foreach ($this->getSchemaDiff($schema, $preSchema) as $query) {
         $queries->addQuery($query);
     }
     $queries->addQuery(sprintf('UPDATE oro_cron_schedule SET args = \'%s\', args_hash = \'%s\'', '[]', md5('[]')));
     $postSchema = clone $preSchema;
     $table = $postSchema->getTable('oro_cron_schedule');
     $table->changeColumn('args', ['notnull' => true]);
     $table->changeColumn('args_hash', ['notnull' => true, 'length' => 32]);
     $table->dropIndex('UQ_COMMAND');
     $table->addUniqueIndex(['command', 'args_hash', 'definition'], 'UQ_COMMAND');
     foreach ($this->getSchemaDiff($preSchema, $postSchema) as $query) {
         $queries->addQuery($query);
     }
 }