/** * Create orocrm_magento_newsl_subscr table * * @param Schema $schema */ protected function createOrocrmMagentoNewslSubscrTable(Schema $schema) { $table = $schema->createTable('orocrm_magento_newsl_subscr'); $table->addColumn('id', 'integer', ['autoincrement' => true]); $table->addColumn('organization_id', 'integer', ['notnull' => false]); $table->addColumn('owner_id', 'integer', ['notnull' => false]); $table->addColumn('customer_id', 'integer', ['notnull' => false]); $table->addColumn('store_id', 'integer', ['notnull' => false]); $table->addColumn('channel_id', 'integer', ['notnull' => false]); $table->addColumn('data_channel_id', 'integer', ['notnull' => false]); $table->addColumn('email', 'string', ['notnull' => false, 'length' => 255]); $table->addColumn('change_status_at', 'datetime', ['notnull' => false, 'comment' => '(DC2Type:datetime)']); $table->addColumn('created_at', 'datetime', ['comment' => '(DC2Type:datetime)']); $table->addColumn('updated_at', 'datetime', ['comment' => '(DC2Type:datetime)']); $table->addColumn('origin_id', 'integer', ['notnull' => false, 'precision' => 0, 'unsigned' => true]); $table->addColumn('confirm_code', 'string', ['notnull' => false, 'length' => 32]); $table->addIndex(['channel_id'], 'idx_7c8eaa72f5a1aa', []); $table->setPrimaryKey(['id']); $table->addIndex(['owner_id'], 'idx_7c8eaa7e3c61f9', []); $table->addIndex(['store_id'], 'idx_7c8eaab092a811', []); $table->addIndex(['organization_id'], 'idx_7c8eaa32c8a3de', []); $table->addIndex(['data_channel_id'], 'idx_7c8eaabdc09b73', []); $table->addUniqueIndex(['customer_id'], 'uniq_7c8eaa9395c3f3'); $this->extendExtension->addEnumField($schema, $table, 'status', 'mage_subscr_status', false, false, ['extend' => ['owner' => ExtendScope::OWNER_CUSTOM]]); }
/** * {@inheritdoc} */ public function up(Schema $schema, QueryBag $queries) { $this->attachmentExtension->addFileRelation($schema, 'orocrm_partner', 'contract', [], 7); $this->attachmentExtension->addAttachmentAssociation($schema, 'orocrm_partner', ['image/*', 'application/pdf', 'application/zip', 'application/x-gzip', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/vnd.ms-powerpoint', 'application/vnd.openxmlformats-officedocument.presentationml.presentation'], 2); $this->noteExtension->addNoteAssociation($schema, 'orocrm_partner'); $this->activityExtension->addActivityAssociation($schema, 'oro_email', 'orocrm_partner'); $this->activityExtension->addActivityAssociation($schema, 'orocrm_partner_github_issue', 'orocrm_partner'); $this->extendExtension->addEnumField($schema, $schema->getTable('orocrm_partner_github_issue'), 'status', 'github_issue_status', false, false, ['extend' => ['owner' => ExtendScope::OWNER_CUSTOM]]); }
/** * {@inheritdoc} */ public function up(Schema $schema, QueryBag $queries) { $existingEnumTables = $this->getExistingEnumTables($schema); $optionSets = $this->dataStorageExtension->get('existing_option_sets'); foreach ($optionSets as &$optionSet) { $entityTableName = $this->extendExtension->getTableNameByEntityClass($optionSet['class_name']); $data = $optionSet['data']; $enumCode = $this->buildEnumCode($optionSet['class_name'], $optionSet['field_name'], $existingEnumTables); $enumTable = $this->extendExtension->addEnumField($schema, $entityTableName, $optionSet['field_name'], $enumCode, $data['extend']['set_expanded'], false, ['extend' => ['owner' => $data['extend']['owner']]]); $existingEnumTables[] = $enumTable->getName(); $optionSet['table_name'] = $entityTableName; $optionSet['enum_class_name'] = ExtendHelper::buildEnumValueClassName($enumCode); $optionSet['enum_table_name'] = $enumTable->getName(); } $this->fillEnumValues($queries, $optionSets); $this->assignEnumValues($queries, $optionSets); $this->removeOptionSetAttributes($queries, $optionSets); }
/** * Create orob2b_customer table * * @param Schema $schema */ protected function createOroB2BCustomerTable(Schema $schema) { $table = $schema->createTable(static::ORO_B2B_CUSTOMER_TABLE_NAME); $table->addColumn('id', 'integer', ['autoincrement' => true]); $table->addColumn('name', 'string', ['length' => 255]); $table->addColumn('parent_id', 'integer', ['notnull' => false]); $table->addColumn('group_id', 'integer', ['notnull' => false]); $table->addColumn('organization_id', 'integer', ['notnull' => false]); $table->setPrimaryKey(['id']); $table->addIndex(['name'], 'orob2b_customer_name_idx', []); $this->attachmentExtension->addAttachmentAssociation($schema, static::ORO_B2B_CUSTOMER_TABLE_NAME, ['image/*', 'application/pdf', 'application/zip', 'application/x-gzip', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/vnd.ms-powerpoint', 'application/vnd.openxmlformats-officedocument.presentationml.presentation']); $this->noteExtension->addNoteAssociation($schema, static::ORO_B2B_CUSTOMER_TABLE_NAME); $this->extendExtension->addEnumField($schema, static::ORO_B2B_CUSTOMER_TABLE_NAME, 'internal_rating', Customer::INTERNAL_RATING_CODE); }
/** * Create orocrm_sales_lead table * * @param Schema $schema */ protected function createOrocrmSalesLeadTable(Schema $schema) { $table = $schema->createTable('orocrm_sales_lead'); $table->addColumn('id', 'integer', ['autoincrement' => true]); $table->addColumn('address_id', 'integer', ['notnull' => false]); $table->addColumn('contact_id', 'integer', ['notnull' => false]); $table->addColumn('user_owner_id', 'integer', ['notnull' => false]); $table->addColumn('customer_id', 'integer', ['notnull' => false]); $table->addColumn('data_channel_id', 'integer', ['notnull' => false]); $table->addColumn('status_name', 'string', ['notnull' => false, 'length' => 32]); $table->addColumn('workflow_item_id', 'integer', ['notnull' => false]); $table->addColumn('workflow_step_id', 'integer', ['notnull' => false]); $table->addColumn('name', 'string', ['length' => 255]); $table->addColumn('name_prefix', 'string', ['notnull' => false, 'length' => 255]); $table->addColumn('first_name', 'string', ['length' => 255]); $table->addColumn('middle_name', 'string', ['notnull' => false, 'length' => 255]); $table->addColumn('last_name', 'string', ['length' => 255]); $table->addColumn('name_suffix', 'string', ['notnull' => false, 'length' => 255]); $table->addColumn('job_title', 'string', ['notnull' => false, 'length' => 255]); $table->addColumn('phone_number', 'string', ['notnull' => false, 'length' => 255]); $table->addColumn('email', 'string', ['notnull' => false, 'length' => 255]); $table->addColumn('company_name', 'string', ['notnull' => false, 'length' => 255]); $table->addColumn('website', 'string', ['notnull' => false, 'length' => 255]); $table->addColumn('number_of_employees', 'integer', ['notnull' => false]); $table->addColumn('industry', 'string', ['notnull' => false, 'length' => 255]); $table->addColumn('createdat', 'datetime', []); $table->addColumn('updatedat', 'datetime', ['notnull' => false]); $table->addColumn('notes', 'text', ['notnull' => false]); $this->extendExtension->addEnumField($schema, 'orocrm_sales_lead', 'source', 'lead_source'); $this->extendExtension->addManyToOneRelation($schema, $table, 'campaign', 'orocrm_campaign', 'combined_name', ['extend' => ['owner' => ExtendScope::OWNER_CUSTOM]]); $table->addIndex(['status_name'], 'idx_73db46336625d392', []); $table->addIndex(['user_owner_id'], 'idx_73db46339eb185f9', []); $table->addIndex(['customer_id'], 'IDX_73DB46339395C3F3', []); $table->addIndex(['data_channel_id'], 'IDX_73DB4633BDC09B73', []); $table->addIndex(['createdat'], 'lead_created_idx', []); $table->addIndex(['contact_id'], 'idx_73db4633e7a1254a', []); $table->setPrimaryKey(['id']); $table->addIndex(['workflow_step_id'], 'idx_73db463371fe882c', []); $table->addIndex(['address_id'], 'idx_73db4633f5b7af75', []); $table->addUniqueIndex(['workflow_item_id'], 'uniq_73db46331023c4ee'); }
/** * {@inheritdoc} */ public function up(Schema $schema, QueryBag $queries) { $this->extendExtension->addEnumField($schema, self::PRODUCT_TABLE_NAME, 'status', 'prod_status'); }
/** * {@inheritdoc} */ public function up(Schema $schema, QueryBag $queries) { $this->extendExtension->addEnumField($schema, 'orocrm_sales_lead', 'source', 'lead_source'); $queries->addPostQuery(sprintf('UPDATE oro_entity_config_field SET mode=\'%s\' WHERE field_name=\'%s\'', ConfigModelManager::MODE_HIDDEN, 'extend_source')); }
/** * @param Schema $schema * @throws SchemaException */ protected function updateProductTable(Schema $schema) { $this->extendExtension->addEnumField($schema, self::PRODUCT_TABLE_NAME, 'inventory_status', 'prod_inventory_status'); $this->extendExtension->addEnumField($schema, self::PRODUCT_TABLE_NAME, 'visibility', 'prod_visibility'); }