本文整理汇总了PHP中Oro\Bundle\MigrationBundle\Migration\QueryBag类的典型用法代码示例。如果您正苦于以下问题:PHP QueryBag类的具体用法?PHP QueryBag怎么用?PHP QueryBag使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QueryBag类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: up
/**
* @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));
}
}
示例2: up
/**
* {@inheritdoc}
*/
public function up(Schema $schema, QueryBag $queries)
{
$queries->addPreQuery(new ParametrizedSqlMigrationQuery('UPDATE orocrm_call SET created_at = :date, updated_at = :date', ['date' => new \DateTime('now', new \DateTimeZone('UTC'))], ['date' => Type::DATETIME]));
$table = $schema->getTable('orocrm_call');
$table->getColumn('created_at')->setOptions(['notnull' => true]);
$table->getColumn('updated_at')->setOptions(['notnull' => true]);
}
示例3: up
/**
* @inheritdoc
*/
public function up(Schema $schema, QueryBag $queries)
{
$this->modifyOrocrmSalesLeadTable($schema);
$this->modifyOrocrmSalesOpportunityTable($schema);
$this->modifyOrocrmSalesSalesFunnelTable($schema);
$queries->addPostQuery(new MigrateAccountRelations());
}
示例4: up
/**
* {@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']));
}
示例5: up
/**
* {@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'));
}
示例6: up
/**
* {@inheritdoc}
*/
public function up(Schema $schema, QueryBag $queries)
{
$this->createAuditField($schema);
$queries->addPostQuery(new MigrateAuditFieldQuery());
$queries->addPostQuery('ALTER TABLE oro_audit DROP COLUMN data');
$queries->addPostQuery($this->getDropEntityConfigFieldQuery('Oro\\Bundle\\DataAuditBundle\\Entity\\Audit', 'data'));
}
示例7: up
/**
* {@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']));
}
}
示例8: up
public function up(Schema $schema, QueryBag $queries)
{
$sqls = $this->container->get('test_service')->getQueries();
foreach ($sqls as $sql) {
$queries->addQuery($sql);
}
}
示例9: changePrimaryKeyType
/**
* @param Schema $schema
* @param QueryBag $queries
* @param string $tableName
* @param string $columnName
* @param string $type
*
* @throws \Exception
*/
public function changePrimaryKeyType(Schema $schema, QueryBag $queries, $tableName, $columnName, $type)
{
$targetColumn = $schema->getTable($tableName)->getColumn($columnName);
$type = Type::getType($type);
if ($targetColumn->getType() === $type) {
return;
}
/** @var ForeignKeyConstraint[] $foreignKeys */
$foreignKeys = [];
foreach ($schema->getTables() as $table) {
/** @var ForeignKeyConstraint[] $tableForeignKeys */
$tableForeignKeys = array_filter($table->getForeignKeys(), function (ForeignKeyConstraint $tableForeignKey) use($tableName, $columnName) {
if ($tableForeignKey->getForeignTableName() !== $tableName) {
return false;
}
return $tableForeignKey->getForeignColumns() === [$columnName];
});
foreach ($tableForeignKeys as $tableForeignKey) {
$foreignKeys[$tableForeignKey->getName()] = $tableForeignKey;
$foreignKeyTableName = $tableForeignKey->getLocalTable()->getName();
$foreignKeyColumnNames = $tableForeignKey->getLocalColumns();
$queries->addPreQuery($this->platform->getDropForeignKeySQL($tableForeignKey, $foreignKeyTableName));
$column = $schema->getTable($foreignKeyTableName)->getColumn(reset($foreignKeyColumnNames));
if ($column instanceof ExtendColumn) {
$column->disableExtendOptions()->setType($type)->enableExtendOptions();
} else {
$column->setType($type);
}
}
}
$targetColumn->setType($type);
foreach ($foreignKeys as $foreignKey) {
$queries->addPostQuery($this->platform->getCreateForeignKeySQL($foreignKey, $foreignKey->getLocalTable()));
}
}
示例10: up
/**
* {@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']));
}
示例11: updateConfigs
/**
* Modify entity config to exclude currency and currency_precision fields
*
* @param Schema $schema
* @param QueryBag $queries
*/
public static function updateConfigs(Schema $schema, QueryBag $queries)
{
$table = $schema->getTable('oro_organization');
$table->dropColumn('currency');
$table->dropColumn('currency_precision');
if ($schema->hasTable('oro_entity_config_index_value') && $schema->hasTable('oro_entity_config_field')) {
$queries->addPostQuery('DELETE FROM oro_entity_config_index_value
WHERE entity_id IS NULL AND field_id IN(
SELECT oecf.id FROM oro_entity_config_field AS oecf
WHERE
(oecf.field_name = \'precision\' OR oecf.field_name = \'currency\')
AND
oecf.entity_id = (
SELECT oec.id
FROM oro_entity_config AS oec
WHERE oec.class_name = \'Oro\\\\Bundle\\\\OrganizationBundle\\\\Entity\\\\Organization\'
)
);
DELETE FROM oro_entity_config_field
WHERE
field_name IN (\'precision\', \'currency\')
AND
entity_id IN (
SELECT id
FROM oro_entity_config
WHERE class_name = \'Oro\\\\Bundle\\\\OrganizationBundle\\\\Entity\\\\Organization\'
)');
}
}
示例12: up
/**
* {@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']));
}
}
示例13: up
/**
* {@inheritdoc}
*/
public function up(Schema $schema, QueryBag $queries)
{
/** Update Email Origin Name */
$queries->addPreQuery(new ParametrizedSqlMigrationQuery('UPDATE oro_email_origin SET name = :new_name WHERE name = :old_name', ['new_name' => 'useremailorigin', 'old_name' => 'imapemailorigin'], ['new_name' => Type::STRING, 'old_name' => Type::STRING]));
/** Tables generation **/
self::addSmtpFieldsToOroEmailOriginTable($schema);
}
示例14: down
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');*/
}
示例15: up
/**
* {@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));
}
}