public function up(Schema $schema)
 {
     $serversTable = $schema->createTable("servers");
     $serversTable->addColumn("id", "integer", array("unsigned" => true, "autoincrement" => true, "notnull" => true));
     $serversTable->addColumn("servername", "string", array("notnull" => true));
     $serversTable->addColumn("ip", "string", array("notnull" => true));
     $serversTable->addColumn("protocol", "string", array("notnull" => true));
     $serversTable->addColumn("params", "string", array("notnull" => false));
     $serversTable->addColumn("created_at", "integer", array("notnull" => true));
     $serversTable->addColumn("updated_at", "integer", array("notnull" => true));
     $serversTable->addColumn("checked_at", "integer", array("notnull" => false));
     $serversTable->setPrimaryKey(array("id"));
     $serversTable->addUniqueIndex(array("servername"));
     $serversTable->addUniqueIndex(array("ip"));
     $softwaresTable = $schema->createTable("softwares");
     $softwaresTable->addColumn("id", "integer", array("unsigned" => true, "autoincrement" => true, "notnull" => true));
     $softwaresTable->addColumn("server_id", "integer", array("notnull" => true));
     $softwaresTable->addColumn("label", "string", array("notnull" => true));
     $softwaresTable->addColumn("port", "integer", array("notnull" => true, "length" => 6));
     $softwaresTable->addColumn("status", "integer", array("notnull" => true, "length" => 1, "default" => '0'));
     $softwaresTable->addColumn("created_at", "integer", array("notnull" => true));
     $softwaresTable->addColumn("updated_at", "integer", array("notnull" => true));
     $softwaresTable->addColumn("checked_at", "integer", array("notnull" => false));
     $softwaresTable->setPrimaryKey(array("id"));
 }
Пример #2
0
 /**
  * @inheritdoc
  */
 public function up(Schema $schema, QueryBag $queries)
 {
     // @codingStandardsIgnoreStart
     /** Generate table oro_report **/
     $table = $schema->createTable(self::TABLE_NAME);
     $table->addColumn('id', 'integer', ['autoincrement' => true]);
     $table->addColumn('business_unit_owner_id', 'integer', ['notnull' => false]);
     $table->addColumn('type', 'string', ['notnull' => false, 'length' => 32]);
     $table->addColumn('name', 'string', ['length' => 255]);
     $table->addColumn('description', 'text', ['notnull' => false]);
     $table->addColumn('entity', 'string', ['length' => 255]);
     $table->addColumn('definition', 'text', []);
     $table->addColumn('createdAt', 'datetime', []);
     $table->addColumn('updatedAt', 'datetime', []);
     $table->setPrimaryKey(['id']);
     $table->addIndex(['type'], 'IDX_B48821B68CDE5729', []);
     $table->addIndex(['business_unit_owner_id'], 'IDX_B48821B659294170', []);
     /** End of generate table oro_report **/
     /** Generate table oro_report_type **/
     $table = $schema->createTable('oro_report_type');
     $table->addColumn('name', 'string', ['length' => 32]);
     $table->addColumn('label', 'string', ['length' => 255]);
     $table->setPrimaryKey(['name']);
     $table->addUniqueIndex(['label'], 'UNIQ_397D3359EA750E8');
     /** End of generate table oro_report_type **/
     /** Generate foreign keys for table oro_report **/
     $table = $schema->getTable(self::TABLE_NAME);
     $table->addForeignKeyConstraint($schema->getTable('oro_business_unit'), ['business_unit_owner_id'], ['id'], ['onDelete' => 'SET NULL', 'onUpdate' => null]);
     $table->addForeignKeyConstraint($schema->getTable('oro_report_type'), ['type'], ['name'], ['onDelete' => null, 'onUpdate' => null]);
     /** End of generate foreign keys for table oro_report **/
     // @codingStandardsIgnoreEnd
 }
 public function testRunActivityLists()
 {
     $connection = $this->getMockBuilder('Doctrine\\DBAL\\Connection')->disableOriginalConstructor()->getMock();
     $connection->expects($this->any())->method('getDatabasePlatform')->will($this->returnValue(new MySqlPlatform()));
     $this->migrationQuery->setConnection($connection);
     $table = $this->schema->createTable('acme_test');
     $table->addColumn('id', 'integer', ['autoincrement' => true]);
     $table->setPrimaryKey(['id']);
     $table = $this->schema->createTable('oro_activity_list');
     $table->addColumn('id', 'integer', ['autoincrement' => true]);
     $table->setPrimaryKey(['id']);
     $extendOptionsManager = new ExtendOptionsManager();
     $entityMetadataHelper = $this->getMockBuilder('Oro\\Bundle\\EntityExtendBundle\\Migration\\EntityMetadataHelper')->disableOriginalConstructor()->getMock();
     $extendExtension = new ExtendExtension($extendOptionsManager, $entityMetadataHelper);
     $extendExtension->setNameGenerator($this->nameGenerator);
     $this->activityListExtension->setExtendExtension($extendExtension);
     $this->provider->expects($this->once())->method('getTargetEntityClasses')->willReturn(['Acme\\TestBundle\\Entity\\Test']);
     $this->metadataHelper->expects($this->once())->method('getTableNameByEntityClass')->with('Acme\\TestBundle\\Entity\\Test')->willReturn('acme_test');
     $entityMetadataHelper->expects($this->any())->method('getEntityClassByTableName')->willReturnCallback(function ($tableName) {
         if ($tableName === 'acme_test') {
             return 'Acme\\TestBundle\\Entity\\Test';
         }
         return 'Oro\\Bundle\\ActivityListBundle\\Entity\\ActivityList';
     });
     $log = $this->migrationQuery->getDescription();
     $this->assertEquals('CREATE TABLE oro_rel_c3990ba6784dd132527c89 (activitylist_id INT NOT NULL, test_id INT NOT NULL, ' . 'INDEX IDX_53682E3596EB1108 (activitylist_id), INDEX IDX_53682E351E5D0459 (test_id), ' . 'PRIMARY KEY(activitylist_id, test_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ' . 'ENGINE = InnoDB', $log[0]);
     $this->assertEquals('ALTER TABLE oro_rel_c3990ba6784dd132527c89 ADD CONSTRAINT FK_53682E3596EB1108 ' . 'FOREIGN KEY (activitylist_id) REFERENCES oro_activity_list (id) ON DELETE CASCADE', $log[1]);
     $this->assertEquals('ALTER TABLE oro_rel_c3990ba6784dd132527c89 ADD CONSTRAINT FK_53682E351E5D0459 FOREIGN KEY (test_id) ' . 'REFERENCES acme_test (id) ON DELETE CASCADE', $log[2]);
 }
Пример #4
0
 public function createShopSchema()
 {
     $schema = new Schema();
     $products = $schema->createTable('Products');
     $products->addColumn('ProductID', 'integer');
     $products->addColumn('SupplierID', 'integer');
     $products->addColumn('ProductName', 'string');
     $products->addColumn('Price', 'decimal', array('scale' => 2, 'precision' => 12));
     $products->setPrimaryKey(array('ProductID'));
     $products->addOption('azure.federated', true);
     $customers = $schema->createTable('Customers');
     $customers->addColumn('CustomerID', 'integer');
     $customers->addColumn('CompanyName', 'string');
     $customers->addColumn('FirstName', 'string');
     $customers->addColumn('LastName', 'string');
     $customers->setPrimaryKey(array('CustomerID'));
     $customers->addOption('azure.federated', true);
     $customers->addOption('azure.federatedOnColumnName', 'CustomerID');
     $orders = $schema->createTable('Orders');
     $orders->addColumn('CustomerID', 'integer');
     $orders->addColumn('OrderID', 'integer');
     $orders->addColumn('OrderDate', 'datetime');
     $orders->setPrimaryKey(array('CustomerID', 'OrderID'));
     $orders->addOption('azure.federated', true);
     $orders->addOption('azure.federatedOnColumnName', 'CustomerID');
     $orderItems = $schema->createTable('OrderItems');
     $orderItems->addColumn('CustomerID', 'integer');
     $orderItems->addColumn('OrderID', 'integer');
     $orderItems->addColumn('ProductID', 'integer');
     $orderItems->addColumn('Quantity', 'integer');
     $orderItems->setPrimaryKey(array('CustomerID', 'OrderID', 'ProductID'));
     $orderItems->addOption('azure.federated', true);
     $orderItems->addOption('azure.federatedOnColumnName', 'CustomerID');
     return $schema;
 }
 /**
  * {@inheritdoc}
  */
 public function up(Schema $schema, QueryBag $queries)
 {
     /** Generate table timelap_tracker **/
     $table = $schema->createTable('timelap_tracker');
     $table->addColumn('id', 'integer', ['autoincrement' => true]);
     $table->addColumn('task_id', 'integer', ['notnull' => false]);
     $table->addColumn('user_id', 'integer', ['notnull' => false]);
     $table->addColumn('date_started', 'datetime', []);
     $table->setPrimaryKey(['id']);
     $table->addIndex(['user_id'], 'IDX_36D2AA8AA76ED395', []);
     $table->addIndex(['task_id'], 'IDX_36D2AA8A8DB60186', []);
     /** End of generate table timelap_tracker **/
     /** Generate table timelap_worklog **/
     $table = $schema->createTable('timelap_worklog');
     $table->addColumn('id', 'integer', ['autoincrement' => true]);
     $table->addColumn('task_id', 'integer', ['notnull' => false]);
     $table->addColumn('user_id', 'integer', ['notnull' => false]);
     $table->addColumn('time_spent', 'integer', []);
     $table->addColumn('date_started', 'datetime', []);
     $table->addColumn('description', 'string', ['notnull' => false, 'length' => 255]);
     $table->setPrimaryKey(['id']);
     $table->addIndex(['task_id'], 'IDX_797F12A38DB60186', []);
     $table->addIndex(['user_id'], 'IDX_797F12A3A76ED395', []);
     /** End of generate table timelap_worklog **/
     /** Generate foreign keys for table timelap_tracker **/
     $table = $schema->getTable('timelap_tracker');
     $table->addForeignKeyConstraint($schema->getTable('orocrm_task'), ['task_id'], ['id'], ['onDelete' => 'CASCADE', 'onUpdate' => null]);
     $table->addForeignKeyConstraint($schema->getTable('oro_user'), ['user_id'], ['id'], ['onDelete' => 'CASCADE', 'onUpdate' => null]);
     /** End of generate foreign keys for table timelap_tracker **/
     /** Generate foreign keys for table timelap_worklog **/
     $table = $schema->getTable('timelap_worklog');
     $table->addForeignKeyConstraint($schema->getTable('orocrm_task'), ['task_id'], ['id'], ['onDelete' => 'CASCADE', 'onUpdate' => null]);
     $table->addForeignKeyConstraint($schema->getTable('oro_user'), ['user_id'], ['id'], ['onDelete' => 'CASCADE', 'onUpdate' => null]);
     /** End of generate foreign keys for table timelap_worklog **/
 }
Пример #6
0
 public function up(Schema $schema)
 {
     #######################################################################
     # Baikal\DavServicesBundle\Entity\Lock
     #######################################################################
     $locks = $schema->createTable('locks');
     $locks->addColumn('id', 'integer')->setAutoincrement(true);
     $locks->addColumn('owner', 'string', array('length' => 100, 'notnull' => false));
     $locks->addColumn('timeout', 'integer', array('notnull' => false));
     $locks->addColumn('created', 'integer', array('notnull' => false));
     $locks->addColumn('token', 'string', array('length' => 100, 'notnull' => false));
     $locks->addColumn('scope', 'integer', array('notnull' => false));
     $locks->addColumn('depth', 'integer', array('notnull' => false));
     $locks->addColumn('uri', 'string', array('length' => 1000, 'notnull' => false));
     $locks->setPrimaryKey(array('id'));
     $locks->addIndex(array('token'));
     #######################################################################
     # Baikal\DavServicesBundle\Entity\PropertyStorage
     #######################################################################
     $propertystorage = $schema->createTable('propertystorage');
     $propertystorage->addColumn('id', 'integer')->setAutoincrement(true);
     $propertystorage->addColumn('path', 'string', array('length' => 1024));
     $propertystorage->addColumn('name', 'string', array('length' => 100));
     $propertystorage->addColumn('value', 'blob');
     $propertystorage->setPrimaryKey(array('id'));
 }
Пример #7
0
 /**
  * @return Schema[]
  */
 protected function prepareSchemas()
 {
     Type::addType('int', 'Doctrine\\DBAL\\Types\\IntegerType');
     $fromSchema = new Schema();
     $table = $fromSchema->createTable('oro_entity_extend_test_table');
     $table->addColumn('id', 'integer', ['autoincrement' => true]);
     $table->addColumn('someExternalColumn', 'string');
     $table->addColumn('relation_id', 'int');
     $table->addIndex(['someExternalColumn'], 'some_external_index_name');
     $table->setPrimaryKey(['id']);
     $tableRelation = $fromSchema->createTable('oro_entity_extend_test_relation');
     $tableRelation->addColumn('id', 'integer', ['autoincrement' => true]);
     $tableRelation->addColumn('someExtendColumn', 'string');
     $tableRelation->addIndex(['someExtendColumn'], 'oro_idx_index_name');
     $tableRelation->setPrimaryKey(['id']);
     $table->addForeignKeyConstraint($tableRelation, ['relation_id'], ['id']);
     $toSchema = new Schema();
     $table = $toSchema->createTable('oro_entity_extend_test_table');
     $table->addColumn('id', 'integer', ['autoincrement' => true]);
     $table->setPrimaryKey(['id']);
     $tableRelation = $toSchema->createTable('oro_entity_extend_test_relation');
     $tableRelation->addColumn('id', 'integer', ['autoincrement' => true]);
     $tableRelation->setPrimaryKey(['id']);
     return [$fromSchema, $toSchema];
 }
Пример #8
0
 /**
  * @inheritdoc
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 public function up(Schema $schema, QueryBag $queries)
 {
     // @codingStandardsIgnoreStart
     /** Generate table oro_config **/
     $table = $schema->createTable('oro_config');
     $table->addColumn('id', 'integer', ['autoincrement' => true]);
     $table->addColumn('entity', 'string', ['notnull' => false, 'length' => 255]);
     $table->addColumn('record_id', 'integer', ['notnull' => false]);
     $table->setPrimaryKey(['id']);
     $table->addUniqueIndex(['entity', 'record_id'], 'CONFIG_UQ_ENTITY');
     /** End of generate table oro_config **/
     /** Generate table oro_config_value **/
     $table = $schema->createTable('oro_config_value');
     $table->addColumn('id', 'integer', ['autoincrement' => true]);
     $table->addColumn('config_id', 'integer', ['notnull' => false]);
     $table->addColumn('name', 'string', ['length' => 255]);
     $table->addColumn('section', 'string', ['notnull' => false, 'length' => 50]);
     $table->addColumn('text_value', 'text', ['notnull' => false]);
     $table->addColumn('object_value', 'object', ['notnull' => false, 'comment' => '(DC2Type:object)']);
     $table->addColumn('array_value', 'array', ['notnull' => false, 'comment' => '(DC2Type:array)']);
     $table->addColumn('type', 'string', ['length' => 20]);
     $table->setPrimaryKey(['id']);
     $table->addUniqueIndex(['name', 'section', 'config_id'], 'CONFIG_VALUE_UQ_ENTITY');
     $table->addIndex(['config_id'], 'IDX_DAF6DF5524DB0683', []);
     /** End of generate table oro_config_value **/
     /** Generate foreign keys for table oro_config_value **/
     $table = $schema->getTable('oro_config_value');
     $table->addForeignKeyConstraint($schema->getTable('oro_config'), ['config_id'], ['id'], ['onDelete' => null, 'onUpdate' => null]);
     /** End of generate foreign keys for table oro_config_value **/
     // @codingStandardsIgnoreEnd
 }
Пример #9
0
 /**
  * Return the modules database metadata.
  * 
  * This not record FK or other indexes.
  * 
  * @return Doctrine\DBAL\Schema\Schema
  * @param Doctrine\DBAL\Schema\Schema $sc The schema to add new tables too
  */
 protected function createModuleDBMeta(Schema $sc)
 {
     $sGroupTableName = self::DB_TABLE_VOUCHER_GROUP;
     $sInstanceTableName = self::DB_TABLE_VOUCHER_INSTANCE;
     $sRuleTableName = self::DB_TABLE_VOUCHER_RULE;
     $sTypeTableName = self::DB_TABLE_VOUCHER_TYPE;
     # Voucher Groups
     $table = $sc->createTable($sGroupTableName);
     $table->addColumn('voucher_group_id', 'integer', array("unsigned" => true, 'autoincrement' => true));
     $table->addColumn('voucher_group_name', 'string', array("length" => 100));
     $table->addColumn('voucher_group_slug', 'string', array("length" => 100));
     $table->addColumn('is_disabled', 'boolean', array("default" => false));
     $table->addColumn('sort_order', 'integer', array("unsigned" => true));
     $table->addColumn('date_created', 'datetime', array());
     $table->setPrimaryKey(array('voucher_group_id'));
     $table->addUniqueIndex(array('voucher_group_slug'), 'gl_voucher_group_uiq1');
     # Voucher Rules
     $table = $sc->createTable($sRuleTableName);
     $table->addColumn('voucher_rule_name', 'string', array('length' => 25));
     $table->addColumn('voucher_rule_slug', 'string', array("length" => 25));
     $table->addColumn('voucher_gen_rule_id', 'integer', array('unsigned' => true, 'autoincrement' => true));
     $table->addColumn('voucher_padding_char', 'string', array('legnth' => '1'));
     $table->addColumn('voucher_prefix', 'string', array('length' => 50));
     $table->addColumn('voucher_suffix', 'string', array('length' => 50));
     $table->addColumn('voucher_length', 'smallint', array('unsigned' => true, 'length' => 3));
     $table->addColumn('date_created', 'datetime', array());
     $table->addColumn('voucher_sequence_no', 'integer', array('unsigned' => true));
     $table->addColumn('voucher_sequence_strategy', 'string', array('length' => 20));
     $table->setPrimaryKey(array('voucher_gen_rule_id'));
     # Voucher Type Table
     $table = $sc->createTable($sTypeTableName);
     $table->addColumn('voucher_type_id', 'integer', array("unsigned" => true, 'autoincrement' => true));
     $table->addColumn("voucher_enabled_from", "datetime", array());
     $table->addColumn("voucher_enabled_to", "datetime", array());
     $table->addColumn('voucher_name', 'string', array('length' => 100));
     $table->addColumn('voucher_name_slug', 'string', array('length' => 100));
     $table->addColumn('voucher_description', 'string', array('length' => 500));
     $table->addColumn('voucher_group_id', 'integer', array('unsigned' => true));
     $table->addColumn('voucher_gen_rule_id', 'integer', array('unsigned' => true));
     $table->setPrimaryKey(array('voucher_type_id'));
     $table->addForeignKeyConstraint('ledger_voucher_group', array('voucher_group_id'), array('voucher_group_id'), array(), 'gl_voucher_type_fk1');
     $table->addForeignKeyConstraint('ledger_voucher_gen_rule', array('voucher_gen_rule_id'), array('voucher_gen_rule_id'), array(), 'gl_voucher_type_fk2s');
     $table->addUniqueIndex(array('voucher_name', 'voucher_enabled_from'), 'gl_voucher_type_uiq1');
     # Vouchers Table (Instance Table)
     $table = $sc->createTable($sInstanceTableName);
     $table->addColumn('voucher_instance_id', 'integer', array("unsigned" => true, 'autoincrement' => true));
     $table->addColumn('voucher_type_id', 'integer', array("unsigned" => true));
     $table->addColumn('voucher_code', 'string', array("length" => 255));
     $table->addColumn('date_created', 'datetime', array());
     $table->setPrimaryKey(array('voucher_instance_id'));
     $table->addForeignKeyConstraint('ledger_voucher_type', array('voucher_type_id'), array('voucher_type_id'), array(), 'gl_voucher_instance_fk1');
     $table->addUniqueIndex(array('voucher_code'), 'gl_voucher_instance_uiq1');
     return $sc;
 }
Пример #10
0
 /**
  * @inheritdoc
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 public function up(Schema $schema, QueryBag $queries)
 {
     // @codingStandardsIgnoreStart
     /** Generate table oro_calendar **/
     $table = $schema->createTable('oro_calendar');
     $table->addColumn('id', 'integer', ['autoincrement' => true]);
     $table->addColumn('user_owner_id', 'integer', ['notnull' => false]);
     $table->addColumn('name', 'string', ['notnull' => false, 'length' => 255]);
     $table->setPrimaryKey(['id']);
     $table->addIndex(['user_owner_id'], 'IDX_1D171519EB185F9', []);
     /** End of generate table oro_calendar **/
     /** Generate table oro_calendar_connection **/
     $table = $schema->createTable('oro_calendar_connection');
     $table->addColumn('id', 'integer', ['autoincrement' => true]);
     $table->addColumn('connected_calendar_id', 'integer', []);
     $table->addColumn('calendar_id', 'integer', []);
     $table->addColumn('created', 'datetime', []);
     $table->addColumn('color', 'string', ['notnull' => false, 'length' => 6]);
     $table->addColumn('background_color', 'string', ['notnull' => false, 'length' => 6]);
     $table->setPrimaryKey(['id']);
     $table->addUniqueIndex(['calendar_id', 'connected_calendar_id'], 'oro_calendar_connection_uq');
     $table->addIndex(['calendar_id'], 'IDX_25D13AB8A40A2C8', []);
     $table->addIndex(['connected_calendar_id'], 'IDX_25D13AB8F94143E3', []);
     /** End of generate table oro_calendar_connection **/
     /** Generate table oro_calendar_event **/
     $table = $schema->createTable('oro_calendar_event');
     $table->addColumn('id', 'integer', ['autoincrement' => true]);
     $table->addColumn('calendar_id', 'integer', []);
     $table->addColumn('title', 'text', []);
     $table->addColumn('start_at', 'datetime', []);
     $table->addColumn('end_at', 'datetime', []);
     $table->addColumn('all_day', 'boolean', []);
     $table->addColumn('reminder', 'boolean', []);
     $table->addColumn('remind_at', 'datetime', ['notnull' => false]);
     $table->addColumn('reminded', 'boolean', ['default' => '0']);
     $table->setPrimaryKey(['id']);
     $table->addIndex(['calendar_id'], 'IDX_2DDC40DDA40A2C8', []);
     $table->addIndex(['calendar_id', 'start_at', 'end_at'], 'oro_calendar_event_idx', []);
     /** End of generate table oro_calendar_event **/
     /** Generate foreign keys for table oro_calendar **/
     $table = $schema->getTable('oro_calendar');
     $table->addForeignKeyConstraint($schema->getTable('oro_user'), ['user_owner_id'], ['id'], ['onDelete' => 'SET NULL', 'onUpdate' => null]);
     /** End of generate foreign keys for table oro_calendar **/
     /** Generate foreign keys for table oro_calendar_connection **/
     $table = $schema->getTable('oro_calendar_connection');
     $table->addForeignKeyConstraint($schema->getTable('oro_calendar'), ['connected_calendar_id'], ['id'], ['onDelete' => 'CASCADE', 'onUpdate' => null]);
     $table->addForeignKeyConstraint($schema->getTable('oro_calendar'), ['calendar_id'], ['id'], ['onDelete' => 'CASCADE', 'onUpdate' => null]);
     /** End of generate foreign keys for table oro_calendar_connection **/
     /** Generate foreign keys for table oro_calendar_event **/
     $table = $schema->getTable('oro_calendar_event');
     $table->addForeignKeyConstraint($schema->getTable('oro_calendar'), ['calendar_id'], ['id'], ['onDelete' => 'CASCADE', 'onUpdate' => null]);
     /** End of generate foreign keys for table oro_calendar_event **/
     // @codingStandardsIgnoreEnd
 }
 /**
  * @param Schema $schema
  */
 public function up(Schema $schema)
 {
     $userRoleTable = $schema->createTable(UserPermissionsServiceProvider::USER_ROLES_TABLE);
     $userRoleTable->addColumn(self::USER_ID_COLUMN, Type::GUID)->setLength(36)->setNotnull(true);
     $userRoleTable->addColumn(self::ROLE_ID_COLUMN, Type::GUID)->setLength(36)->setNotnull(true);
     $userRoleTable->setPrimaryKey(array(self::USER_ID_COLUMN, self::ROLE_ID_COLUMN));
     $rolePermissionTable = $schema->createTable(UserPermissionsServiceProvider::ROLE_PERMISSIONS_TABLE);
     $rolePermissionTable->addColumn(self::ROLE_ID_COLUMN, Type::GUID)->setLength(36)->setNotnull(true);
     $rolePermissionTable->addColumn(self::PERMISSION_COLUMN, Type::STRING)->setLength(255)->setNotnull(true);
     $rolePermissionTable->setPrimaryKey(array(self::ROLE_ID_COLUMN, self::PERMISSION_COLUMN));
 }
Пример #12
0
 public function up(Schema $schema)
 {
     #######################################################################
     # Baikal\DavServicesBundle\Entity\Addressbook
     #######################################################################
     $addressbooks = $schema->createTable('addressbooks');
     $addressbooks->addColumn('id', 'integer')->setAutoincrement(true);
     $addressbooks->addColumn('principaluri', 'string', array('length' => 255, 'notnull' => false));
     $addressbooks->addColumn('displayname', 'string', array('length' => 255, 'notnull' => false));
     $addressbooks->addColumn('uri', 'string', array('length' => 255, 'notnull' => false));
     $addressbooks->addColumn('synctoken', 'integer', array('notnull' => false));
     $addressbooks->addColumn('description', 'text', array('notnull' => false));
     $addressbooks->setPrimaryKey(array('id'));
     $addressbooks->addUniqueIndex(array('principaluri', 'uri'));
     #######################################################################
     # Baikal\DavServicesBundle\Entity\AddressbookContact
     #######################################################################
     $cards = $schema->createTable('cards');
     $cards->addColumn('id', 'integer')->setAutoincrement(true);
     $cards->addColumn('carddata', 'text', array('notnull' => false));
     $cards->addColumn('uri', 'string', array('length' => 255, 'notnull' => false));
     $cards->addColumn('lastmodified', 'integer', array('notnull' => false));
     $cards->addColumn('etag', 'string', array('length' => 32, 'notnull' => false));
     $cards->addColumn('size', 'integer', array('notnull' => false));
     $cards->addColumn('addressbookid', 'integer');
     $cards->setPrimaryKey(array('id'));
     #######################################################################
     # Baikal\DavServicesBundle\Entity\AddressbookChange
     #######################################################################
     $addressbookchanges = $schema->createTable('addressbookchanges');
     $addressbookchanges->addColumn('id', 'integer')->setAutoincrement(true);
     $addressbookchanges->addColumn('uri', 'string', array('length' => 255, 'notnull' => false));
     $addressbookchanges->addColumn('synctoken', 'integer', array('notnull' => false));
     $addressbookchanges->addColumn('operation', 'boolean', array('notnull' => false));
     $addressbookchanges->addColumn('addressbookid', 'integer');
     $addressbookchanges->setPrimaryKey(array('id'));
     $addressbookchanges->addIndex(array('addressbookid', 'synctoken'), 'addressbookid_synctoken');
     #######################################################################
     # Relations
     #######################################################################
     # addressbooks <= cards
     #$cards->addForeignKeyConstraint(
     #    $addressbooks,              # Foreign table
     #    array('addressbookid'),     # Local key
     #    array('id')                 # Foreign key
     #);
     # addressbooks <= addressbookchanges
     #$addressbookchanges->addForeignKeyConstraint(
     #    $addressbooks,              # Foreign table
     #    array('addressbookid'),     # Local key
     #    array('id')                 # Foreign key
     #);
 }
Пример #13
0
 /**
  * {@inheritdoc}
  */
 public function up(Schema $schema, QueryBag $queries)
 {
     /** Generate table oro_tracking_data **/
     $table = $schema->createTable('oro_tracking_data');
     $table->addColumn('id', 'integer', ['autoincrement' => true]);
     $table->addColumn('event_id', 'integer', ['notnull' => false]);
     $table->addColumn('data', 'text', []);
     $table->addColumn('created_at', 'datetime', []);
     $table->setPrimaryKey(['id']);
     $table->addUniqueIndex(['event_id'], 'UNIQ_B3CFDD2D71F7E88B');
     /** End of generate table oro_tracking_data **/
     /** Generate table oro_tracking_event **/
     $table = $schema->createTable('oro_tracking_event');
     $table->addColumn('id', 'integer', ['autoincrement' => true]);
     $table->addColumn('website_id', 'integer', ['notnull' => false]);
     $table->addColumn('name', 'string', ['length' => 255]);
     $table->addColumn('value', 'float', ['notnull' => false]);
     $table->addColumn('user', 'string', ['length' => 255]);
     $table->addColumn('created_at', 'datetime', []);
     $table->addColumn('logged_at', 'datetime', []);
     $table->addColumn('url', 'string', ['length' => 255]);
     $table->addColumn('title', 'string', ['notnull' => false, 'length' => 255]);
     $table->setPrimaryKey(['id']);
     $table->addIndex(['website_id'], 'IDX_AAD45A1E18F45C82', []);
     $table->addIndex(['name'], 'event_name_idx', []);
     $table->addIndex(['logged_at'], 'event_loggedAt_idx', []);
     /** End of generate table oro_tracking_event **/
     /** Generate table oro_tracking_website **/
     $table = $schema->createTable('oro_tracking_website');
     $table->addColumn('id', 'integer', ['autoincrement' => true]);
     $table->addColumn('user_owner_id', 'integer', ['notnull' => false]);
     $table->addColumn('name', 'string', ['length' => 255]);
     $table->addColumn('identifier', 'string', ['length' => 255]);
     $table->addColumn('url', 'string', ['length' => 255]);
     $table->addColumn('created_at', 'datetime', []);
     $table->addColumn('updated_at', 'datetime', ['notnull' => false]);
     $table->setPrimaryKey(['id']);
     $table->addUniqueIndex(['identifier'], 'UNIQ_19038898772E836A');
     $table->addIndex(['user_owner_id'], 'IDX_190388989EB185F9', []);
     /** End of generate table oro_tracking_website **/
     /** Generate foreign keys for table oro_tracking_data **/
     $table = $schema->getTable('oro_tracking_data');
     $table->addForeignKeyConstraint($schema->getTable('oro_tracking_event'), ['event_id'], ['id'], ['onDelete' => 'CASCADE', 'onUpdate' => null]);
     /** End of generate foreign keys for table oro_tracking_data **/
     /** Generate foreign keys for table oro_tracking_event **/
     $table = $schema->getTable('oro_tracking_event');
     $table->addForeignKeyConstraint($schema->getTable('oro_tracking_website'), ['website_id'], ['id'], ['onDelete' => 'CASCADE', 'onUpdate' => null]);
     /** End of generate foreign keys for table oro_tracking_event **/
     /** Generate foreign keys for table oro_tracking_website **/
     $table = $schema->getTable('oro_tracking_website');
     $table->addForeignKeyConstraint($schema->getTable('oro_user'), ['user_owner_id'], ['id'], ['onDelete' => 'SET NULL', 'onUpdate' => null]);
     /** End of generate foreign keys for table oro_tracking_website **/
 }
 /**
  * @param Schema $schema
  */
 protected function createOroB2BPaymentIntersectionTables(Schema $schema)
 {
     $table = $schema->createTable(static::PAYMENT_TERM_TO_ACCOUNT_TABLE);
     $table->addColumn('payment_term_id', 'integer', []);
     $table->addColumn('account_id', 'integer', []);
     $table->setPrimaryKey(['payment_term_id', 'account_id']);
     $table->addUniqueIndex(['account_id']);
     $table = $schema->createTable(static::PAYMENT_TERM_TO_ACCOUNT_GROUP_TABLE);
     $table->addColumn('payment_term_id', 'integer', []);
     $table->addColumn('account_group_id', 'integer', []);
     $table->setPrimaryKey(['payment_term_id', 'account_group_id']);
     $table->addUniqueIndex(['account_group_id']);
 }
Пример #15
0
 /**
  * @inheritdoc
  */
 public function up(Schema $schema, QueryBag $queries)
 {
     // @codingStandardsIgnoreStart
     /** Generate table orocrm_call **/
     $table = $schema->createTable('orocrm_call');
     $table->addColumn('id', 'integer', ['autoincrement' => true]);
     $table->addColumn('call_direction_name', 'string', ['notnull' => false, 'length' => 32]);
     $table->addColumn('related_account_id', 'integer', ['notnull' => false]);
     $table->addColumn('related_contact_id', 'integer', ['notnull' => false]);
     $table->addColumn('call_status_name', 'string', ['notnull' => false, 'length' => 32]);
     $table->addColumn('owner_id', 'integer', ['notnull' => false]);
     $table->addColumn('contact_phone_id', 'integer', ['notnull' => false]);
     $table->addColumn('subject', 'string', ['length' => 255]);
     $table->addColumn('phone_number', 'string', ['notnull' => false, 'length' => 255]);
     $table->addColumn('notes', 'text', ['notnull' => false]);
     $table->addColumn('call_date_time', 'datetime', []);
     $table->addColumn('duration', 'time', ['notnull' => false]);
     $table->setPrimaryKey(['id']);
     $table->addIndex(['owner_id'], 'IDX_1FBD1A247E3C61F9', []);
     $table->addIndex(['related_contact_id'], 'IDX_1FBD1A246D6C2DFA', []);
     $table->addIndex(['related_account_id'], 'IDX_1FBD1A2411A6570A', []);
     $table->addIndex(['contact_phone_id'], 'IDX_1FBD1A24A156BF5C', []);
     $table->addIndex(['call_status_name'], 'IDX_1FBD1A2476DB3689', []);
     $table->addIndex(['call_direction_name'], 'IDX_1FBD1A249F3E257D', []);
     /** End of generate table orocrm_call **/
     /** Generate table orocrm_call_direction **/
     $table = $schema->createTable('orocrm_call_direction');
     $table->addColumn('name', 'string', ['length' => 32]);
     $table->addColumn('label', 'string', ['length' => 255]);
     $table->setPrimaryKey(['name']);
     $table->addUniqueIndex(['label'], 'UNIQ_D0EB34BAEA750E8');
     /** End of generate table orocrm_call_direction **/
     /** Generate table orocrm_call_status **/
     $table = $schema->createTable('orocrm_call_status');
     $table->addColumn('name', 'string', ['length' => 32]);
     $table->addColumn('label', 'string', ['length' => 255]);
     $table->setPrimaryKey(['name']);
     $table->addUniqueIndex(['label'], 'UNIQ_FBA13581EA750E8');
     /** End of generate table orocrm_call_status **/
     /** Generate foreign keys for table orocrm_call **/
     $table = $schema->getTable('orocrm_call');
     $table->addForeignKeyConstraint($schema->getTable('orocrm_call_direction'), ['call_direction_name'], ['name'], ['onDelete' => 'SET NULL', 'onUpdate' => null]);
     $table->addForeignKeyConstraint($schema->getTable('orocrm_account'), ['related_account_id'], ['id'], ['onDelete' => 'SET NULL', 'onUpdate' => null]);
     $table->addForeignKeyConstraint($schema->getTable('orocrm_contact'), ['related_contact_id'], ['id'], ['onDelete' => 'SET NULL', 'onUpdate' => null]);
     $table->addForeignKeyConstraint($schema->getTable('orocrm_call_status'), ['call_status_name'], ['name'], ['onDelete' => 'SET NULL', 'onUpdate' => null]);
     $table->addForeignKeyConstraint($schema->getTable('oro_user'), ['owner_id'], ['id'], ['onDelete' => 'SET NULL', 'onUpdate' => null]);
     $table->addForeignKeyConstraint($schema->getTable('orocrm_contact_phone'), ['contact_phone_id'], ['id'], ['onDelete' => 'SET NULL', 'onUpdate' => null]);
     /** End of generate foreign keys for table orocrm_call **/
     // @codingStandardsIgnoreEnd
 }
 /**
  * @return Schema
  */
 public function createFixtureSchema()
 {
     $schema = new Schema();
     $tableA = $schema->createTable("foo");
     $tableA->addColumn("id", 'integer');
     $tableA->addColumn("bar", 'string', array('length' => 255));
     $tableA->setPrimaryKey(array("id"));
     $schema->createSequence("foo_seq");
     $tableB = $schema->createTable("bar");
     $tableB->addColumn("id", 'integer');
     $tableB->setPrimaryKey(array("id"));
     $tableA->addForeignKeyConstraint($tableB, array("bar"), array("id"));
     return $schema;
 }
Пример #17
0
 /**
  * @param Schema $schema
  */
 public function up(Schema $schema)
 {
     // create beer table
     $beerTable = $schema->createTable('beers');
     $beerTable->addColumn('id', Type::INTEGER, array('unsigned' => true))->setAutoincrement(true);
     $beerTable->addColumn('from_user', Type::STRING, array('length' => 32));
     $beerTable->addColumn('to_user', Type::STRING, array('length' => 32));
     $beerTable->setPrimaryKey(['id']);
     // create messages table
     $messagesTable = $schema->createTable('messages');
     $messagesTable->addColumn('id', Type::INTEGER, array('unsigned' => true))->setAutoincrement(true);
     $messagesTable->addColumn('message', Type::TEXT);
     $messagesTable->setPrimaryKey(['id']);
 }
 /**
  * @group DBAL-204
  */
 public function testCleanupForeignKeysDifferentOrder()
 {
     $config = new SchemaConfig();
     $config->setName("test");
     $schema = new Schema(array(), array(), $config);
     $testTable = $schema->createTable("test.test");
     $testTable->addColumn('id', 'integer');
     $fooTable = $schema->createTable("foo.bar");
     $fooTable->addColumn('id', 'integer');
     $testTable->addForeignKeyConstraint("foo.bar", array("id"), array("id"));
     $schema->visit(new RemoveNamespacedAssets());
     $sql = $schema->toSql(new MySqlPlatform());
     $this->assertEquals(1, count($sql), "Just one CREATE TABLE statement, no foreign key and table to foo.bar");
 }
Пример #19
0
 /**
  * @inheritdoc
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 public function up(Schema $schema, QueryBag $queries)
 {
     // @codingStandardsIgnoreStart
     /** Generate table orocrm_account **/
     $table = $schema->createTable('orocrm_account');
     $table->addColumn('id', 'integer', ['autoincrement' => true]);
     $table->addColumn('default_contact_id', 'integer', ['notnull' => false]);
     $table->addColumn('shipping_address_id', 'integer', ['notnull' => false]);
     $table->addColumn('billing_address_id', 'integer', ['notnull' => false]);
     $table->addColumn('user_owner_id', 'integer', ['notnull' => false]);
     $table->addColumn('name', 'string', ['length' => 255]);
     $table->addColumn('createdAt', 'datetime', []);
     $table->addColumn('updatedAt', 'datetime', []);
     $table->addColumn('extend_description', 'text', ['oro_options' => ['extend' => ['owner' => ExtendScope::OWNER_CUSTOM], 'datagrid' => ['is_visible' => false], 'merge' => ['display' => true], 'dataaudit' => ['auditable' => true]]]);
     $table->addColumn('extend_website', 'string', ['oro_options' => ['extend' => ['owner' => ExtendScope::OWNER_CUSTOM], 'datagrid' => ['is_visible' => false], 'merge' => ['display' => true], 'dataaudit' => ['auditable' => true]]]);
     $table->addColumn('extend_employees', 'integer', ['oro_options' => ['extend' => ['owner' => ExtendScope::OWNER_CUSTOM], 'datagrid' => ['is_visible' => false], 'merge' => ['display' => true], 'dataaudit' => ['auditable' => true]]]);
     $table->addColumn('extend_ownership', 'string', ['oro_options' => ['extend' => ['owner' => ExtendScope::OWNER_CUSTOM], 'datagrid' => ['is_visible' => false], 'merge' => ['display' => true], 'dataaudit' => ['auditable' => true]]]);
     $table->addColumn('extend_ticker_symbol', 'string', ['oro_options' => ['extend' => ['owner' => ExtendScope::OWNER_CUSTOM], 'datagrid' => ['is_visible' => false], 'merge' => ['display' => true], 'dataaudit' => ['auditable' => true]]]);
     $table->addColumn('extend_rating', 'string', ['oro_options' => ['extend' => ['owner' => ExtendScope::OWNER_CUSTOM], 'datagrid' => ['is_visible' => false], 'merge' => ['display' => true], 'dataaudit' => ['auditable' => true]]]);
     $table->setPrimaryKey(['id']);
     $table->addIndex(['user_owner_id'], 'IDX_7166D3719EB185F9', []);
     $table->addIndex(['shipping_address_id'], 'IDX_7166D3714D4CFF2B', []);
     $table->addIndex(['billing_address_id'], 'IDX_7166D37179D0C0E4', []);
     $table->addIndex(['default_contact_id'], 'IDX_7166D371AF827129', []);
     $table->addIndex(['name'], 'account_name_idx', []);
     /** End of generate table orocrm_account **/
     /** Generate table orocrm_account_to_contact **/
     $table = $schema->createTable('orocrm_account_to_contact');
     $table->addColumn('account_id', 'integer', []);
     $table->addColumn('contact_id', 'integer', []);
     $table->setPrimaryKey(['account_id', 'contact_id']);
     $table->addIndex(['account_id'], 'IDX_65B8FBEC9B6B5FBA', []);
     $table->addIndex(['contact_id'], 'IDX_65B8FBECE7A1254A', []);
     /** End of generate table orocrm_account_to_contact **/
     /** Generate foreign keys for table orocrm_account **/
     $table = $schema->getTable('orocrm_account');
     $table->addForeignKeyConstraint($schema->getTable('orocrm_contact'), ['default_contact_id'], ['id'], ['onDelete' => 'SET NULL', 'onUpdate' => null]);
     $table->addForeignKeyConstraint($schema->getTable('oro_address'), ['shipping_address_id'], ['id'], ['onDelete' => 'SET NULL', 'onUpdate' => null]);
     $table->addForeignKeyConstraint($schema->getTable('oro_address'), ['billing_address_id'], ['id'], ['onDelete' => 'SET NULL', 'onUpdate' => null]);
     $table->addForeignKeyConstraint($schema->getTable('oro_user'), ['user_owner_id'], ['id'], ['onDelete' => 'SET NULL', 'onUpdate' => null]);
     /** End of generate foreign keys for table orocrm_account **/
     /** Generate foreign keys for table orocrm_account_to_contact **/
     $table = $schema->getTable('orocrm_account_to_contact');
     $table->addForeignKeyConstraint($schema->getTable('orocrm_contact'), ['contact_id'], ['id'], ['onDelete' => 'CASCADE', 'onUpdate' => null]);
     $table->addForeignKeyConstraint($schema->getTable('orocrm_account'), ['account_id'], ['id'], ['onDelete' => 'CASCADE', 'onUpdate' => null]);
     /** End of generate foreign keys for table orocrm_account_to_contact **/
     // @codingStandardsIgnoreEnd
 }
Пример #20
0
 /**
  * @inheritdoc
  */
 public function up(Schema $schema, QueryBag $queries)
 {
     // @codingStandardsIgnoreStart
     /** Generate table oro_segment **/
     $table = $schema->createTable('oro_segment');
     $table->addColumn('id', 'integer', ['autoincrement' => true]);
     $table->addColumn('business_unit_owner_id', 'integer', ['notnull' => false]);
     $table->addColumn('type', 'string', ['notnull' => true, 'length' => 32]);
     $table->addColumn('name', 'string', ['length' => 255]);
     $table->addColumn('description', 'text', ['notnull' => false]);
     $table->addColumn('entity', 'string', ['length' => 255]);
     $table->addColumn('definition', 'text', []);
     $table->addColumn('createdAt', 'datetime', []);
     $table->addColumn('updatedAt', 'datetime', []);
     $table->addColumn('last_run', 'datetime', ['notnull' => false]);
     $table->setPrimaryKey(['id']);
     $table->addIndex(['type'], 'IDX_D02603B38CDE5729', []);
     $table->addIndex(['business_unit_owner_id'], 'IDX_D02603B359294170', []);
     $table->addUniqueIndex(['name'], 'UNIQ_D02603B35E237E06');
     /** End of generate table oro_segment **/
     /** Generate table oro_segment_type **/
     $table = $schema->createTable('oro_segment_type');
     $table->addColumn('name', 'string', ['length' => 32]);
     $table->addColumn('label', 'string', ['length' => 255]);
     $table->setPrimaryKey(['name']);
     $table->addUniqueIndex(['label'], 'UNIQ_29D10555EA750E8');
     /** End of generate table oro_segment_type **/
     /** Generate table oro_segment_snapshot **/
     $table = $schema->createTable('oro_segment_snapshot');
     $table->addColumn('id', 'integer', ['autoincrement' => true]);
     $table->addColumn('entity_id', 'integer', []);
     $table->addColumn('segment_id', 'integer', ['notnull' => true]);
     $table->addColumn('createdAt', 'datetime', []);
     $table->addIndex(['segment_id'], 'IDX_43B8BB67DB296AAD');
     $table->addUniqueIndex(['segment_id', 'entity_id'], 'UNIQ_43B8BB67DB296AAD81257D5D');
     $table->setPrimaryKey(['id']);
     /** End of generate table oro_segment_snapshot **/
     /** Generate foreign keys for table oro_segment **/
     $table = $schema->getTable('oro_segment');
     $table->addForeignKeyConstraint($schema->getTable('oro_business_unit'), ['business_unit_owner_id'], ['id'], ['onDelete' => 'SET NULL', 'onUpdate' => null]);
     $table->addForeignKeyConstraint($schema->getTable('oro_segment_type'), ['type'], ['name'], ['onDelete' => null, 'onUpdate' => null]);
     /** End of generate foreign keys for table oro_segment **/
     /** Generate foreign keys for table oro_segment_snapshot **/
     $table = $schema->getTable('oro_segment_snapshot');
     $table->addForeignKeyConstraint($schema->getTable('oro_segment'), ['segment_id'], ['id'], ['onDelete' => 'CASCADE', 'onUpdate' => null]);
     /** End of generate foreign keys for table oro_segment_snapshot **/
     // @codingStandardsIgnoreEnd
 }
Пример #21
0
 /**
  * Generate table oro_reminder
  *
  * @param Schema $schema
  */
 public static function oroReminderTable(Schema $schema)
 {
     /** Generate table oro_reminder **/
     $table = $schema->createTable('oro_reminder');
     $table->addColumn('id', 'integer', ['autoincrement' => true]);
     $table->addColumn('recipient_id', 'integer', ['notnull' => false]);
     $table->addColumn('subject', 'string', ['length' => 32]);
     $table->addColumn('start_at', 'datetime', []);
     $table->addColumn('expire_at', 'datetime', []);
     $table->addColumn('method', 'string', ['length' => 255]);
     $table->addColumn('interval_number', 'integer', []);
     $table->addColumn('interval_unit', 'string', ['length' => 1]);
     $table->addColumn('state', 'string', ['length' => 32]);
     $table->addColumn('related_entity_id', 'integer', []);
     $table->addColumn('related_entity_classname', 'string', ['length' => 255]);
     $table->addColumn('created_at', 'datetime', []);
     $table->addColumn('updated_at', 'datetime', ['notnull' => false]);
     $table->addColumn('sent_at', 'datetime', ['notnull' => false]);
     $table->addColumn('failure_exception', 'array', ['notnull' => false, 'comment' => '(DC2Type:array)']);
     $table->setPrimaryKey(['id']);
     $table->addIndex(['recipient_id'], 'IDX_2F4F9F57E92F8F78', []);
     $table->addIndex(['state'], 'reminder_state_idx', []);
     /** End of generate table oro_reminder **/
     /** Generate foreign keys for table oro_reminder **/
     $table->addForeignKeyConstraint($schema->getTable('oro_user'), ['recipient_id'], ['id'], ['onDelete' => 'CASCADE', 'onUpdate' => null]);
     /** End of generate foreign keys for table oro_reminder **/
 }
Пример #22
0
 /**
  * @param Schema $schema
  */
 private function createAuditField(Schema $schema)
 {
     $oroAuditFieldTable = $schema->createTable('oro_audit_field');
     $oroAuditFieldTable->addColumn('id', 'integer', ['autoincrement' => true]);
     $oroAuditFieldTable->addColumn('audit_id', 'integer', []);
     $oroAuditFieldTable->addColumn('field', 'string', ['length' => 255]);
     $oroAuditFieldTable->addColumn('data_type', 'string', ['length' => 255]);
     $oroAuditFieldTable->addColumn('old_integer', 'bigint', ['notnull' => false]);
     $oroAuditFieldTable->addColumn('old_float', 'float', ['notnull' => false]);
     $oroAuditFieldTable->addColumn('old_boolean', 'boolean', ['notnull' => false]);
     $oroAuditFieldTable->addColumn('old_text', 'text', ['notnull' => false]);
     $oroAuditFieldTable->addColumn('old_date', 'date', ['notnull' => false]);
     $oroAuditFieldTable->addColumn('old_time', 'time', ['notnull' => false]);
     $oroAuditFieldTable->addColumn('old_datetime', 'datetime', ['notnull' => false]);
     $oroAuditFieldTable->addColumn('new_integer', 'bigint', ['notnull' => false]);
     $oroAuditFieldTable->addColumn('new_float', 'float', ['notnull' => false]);
     $oroAuditFieldTable->addColumn('new_boolean', 'boolean', ['notnull' => false]);
     $oroAuditFieldTable->addColumn('new_text', 'text', ['notnull' => false]);
     $oroAuditFieldTable->addColumn('new_date', 'date', ['notnull' => false]);
     $oroAuditFieldTable->addColumn('new_time', 'time', ['notnull' => false]);
     $oroAuditFieldTable->addColumn('new_datetime', 'datetime', ['notnull' => false]);
     $oroAuditFieldTable->setPrimaryKey(['id']);
     $oroAuditFieldTable->addIndex(['audit_id'], 'IDX_9A31A824BD29F359', []);
     $oroAuditFieldTable->addForeignKeyConstraint($schema->getTable('oro_audit'), ['audit_id'], ['id'], ['onDelete' => 'CASCADE', 'onUpdate' => null]);
 }
Пример #23
0
 /**
  * @param \Doctrine\DBAL\Schema\Schema $schema
  * @param \SimpleXMLElement $xml
  * @throws \DomainException
  */
 private function loadTable($schema, $xml)
 {
     $table = null;
     foreach ($xml->children() as $child) {
         /**
          * @var \SimpleXMLElement $child
          */
         switch ($child->getName()) {
             case 'name':
                 $name = (string) $child;
                 $name = str_replace('*dbprefix*', $this->DBTABLEPREFIX, $name);
                 $name = $this->platform->quoteIdentifier($name);
                 $table = $schema->createTable($name);
                 $table->addOption('collate', 'utf8_bin');
                 break;
             case 'create':
             case 'overwrite':
             case 'charset':
                 break;
             case 'declaration':
                 if (is_null($table)) {
                     throw new \DomainException('Table declaration before table name');
                 }
                 $this->loadDeclaration($table, $child);
                 break;
             default:
                 throw new \DomainException('Unknown element: ' . $child->getName());
         }
     }
 }
 /**
  * Create marello_address table
  *
  * @param Schema $schema
  */
 protected function createMarelloAddressTable(Schema $schema)
 {
     $table = $schema->createTable('marello_address');
     $table->addColumn('id', 'integer', ['autoincrement' => true]);
     $table->addColumn('region_code', 'string', ['notnull' => false, 'length' => 16]);
     $table->addColumn('country_code', 'string', ['notnull' => false, 'length' => 2]);
     $table->addColumn('email', 'string', ['notnull' => false, 'length' => 255]);
     $table->addColumn('phone', 'string', ['notnull' => false, 'length' => 32]);
     $table->addColumn('label', 'string', ['notnull' => false, 'length' => 255]);
     $table->addColumn('street', 'string', ['notnull' => false, 'length' => 500]);
     $table->addColumn('street2', 'string', ['notnull' => false, 'length' => 500]);
     $table->addColumn('city', 'string', ['notnull' => false, 'length' => 255]);
     $table->addColumn('postal_code', 'string', ['notnull' => false, 'length' => 255]);
     $table->addColumn('organization', 'string', ['notnull' => false, 'length' => 255]);
     $table->addColumn('region_text', 'string', ['notnull' => false, 'length' => 255]);
     $table->addColumn('name_prefix', 'string', ['notnull' => false, 'length' => 255]);
     $table->addColumn('first_name', 'string', ['notnull' => false, 'length' => 255]);
     $table->addColumn('middle_name', 'string', ['notnull' => false, 'length' => 255]);
     $table->addColumn('last_name', 'string', ['notnull' => false, 'length' => 255]);
     $table->addColumn('name_suffix', 'string', ['notnull' => false, 'length' => 255]);
     $table->addColumn('created', 'datetime', ['comment' => '(DC2Type:datetime)']);
     $table->addColumn('updated', 'datetime', ['comment' => '(DC2Type:datetime)']);
     $table->addIndex(['region_code'], 'idx_1c837761aeb327af', []);
     $table->setPrimaryKey(['id']);
     $table->addIndex(['country_code'], 'idx_1c837761f026bb7c', []);
 }
Пример #25
0
 public function getMonitoringTable(SchemaBuilder $builder)
 {
     $table = $builder->createTable("later_job_monitor");
     # setup pk
     $table->addColumn('monitor_id', 'integer', array("unsigned" => true, 'autoincrement' => true));
     $table->setPrimaryKey(array("monitor_id"));
     # date and hour
     $table->addColumn('monitor_dte', 'datetime', array());
     # add index
     $table->addUniqueIndex(array('monitor_dte'));
     # worker stats
     $table->addColumn('worker_max_time', 'integer', array("unsigned" => true, 'notnull' => false));
     $table->addColumn('worker_min_time', 'integer', array("unsigned" => true, 'notnull' => false));
     $table->addColumn('worker_mean_time', 'integer', array("unsigned" => true, 'notnull' => false));
     $table->addColumn('worker_mean_throughput', 'integer', array("unsigned" => true, 'notnull' => false));
     $table->addColumn('worker_max_throughput', 'integer', array("unsigned" => true, 'notnull' => false));
     $table->addColumn('worker_mean_utilization', 'float', array("unsigned" => true, 'notnull' => false));
     # queue stats
     $table->addColumn('queue_no_waiting_jobs', 'integer', array("unsigned" => true, 'notnull' => false));
     $table->addColumn('queue_no_failed_jobs', 'integer', array("unsigned" => true, 'notnull' => false));
     $table->addColumn('queue_no_error_jobs', 'integer', array("unsigned" => true, 'notnull' => false));
     $table->addColumn('queue_no_completed_jobs', 'integer', array("unsigned" => true, 'notnull' => false));
     $table->addColumn('queue_no_processing_jobs', 'integer', array("unsigned" => true, 'notnull' => false));
     $table->addColumn('queue_mean_service_time', 'integer', array("unsigned" => true, 'notnull' => false));
     $table->addColumn('queue_min_service_time', 'integer', array("unsigned" => true, 'notnull' => false));
     $table->addColumn('queue_max_service_time', 'integer', array("unsigned" => true, 'notnull' => false));
     $table->addColumn('monitor_complete', 'boolean', array('default' => false));
 }
 /**
  * @param Schema $schema
  */
 public function up(Schema $schema)
 {
     // this up() migration is auto-generated, please modify it to your needs
     $table = $schema->createTable("foo");
     $table->addColumn('id', 'integer', array('autoincrement' => true));
     $table->setPrimaryKey(array('id'));
 }
Пример #27
0
 /**
  * Creates 'oro_email_mailbox_process' table which represents MailboxProcessSettings entity.
  * A common shared mapped superclass for all mailbox process settings types.
  *
  * @param Schema $schema
  */
 public static function createOroEmailMailboxProcessSettingsTable(Schema $schema)
 {
     $table = $schema->createTable('oro_email_mailbox_process');
     $table->addColumn('id', 'integer', ['autoincrement' => true]);
     $table->addColumn('type', 'string', ['length' => 30]);
     $table->setPrimaryKey(['id']);
 }
 /**
  * @param Schema $schema
  */
 public function up(Schema $schema)
 {
     $table = $schema->createTable('event_permission_readmodel');
     $table->addColumn('event_id', 'guid', array('length' => 36, 'notnull' => true));
     $table->addColumn('user_id', 'guid', array('length' => 36, 'notnull' => true));
     $table->setPrimaryKey(['event_id', 'user_id']);
 }
Пример #29
0
 /**
  * @param Schema $schema
  * @param string $table
  * @throws \Doctrine\DBAL\Schema\SchemaException
  */
 public static function addToSchema(Schema $schema, $table)
 {
     if ($schema->hasTable($table)) {
         $table = $schema->getTable($table);
     } else {
         $table = $schema->createTable($table);
     }
     if (!$table->hasColumn('event_id')) {
         $id = $table->addColumn('event_id', 'integer', ['unsigned' => true]);
         $id->setAutoincrement(true);
         $table->setPrimaryKey(['event_id']);
     }
     if (!$table->hasColumn('aggregate_id')) {
         $table->addColumn('aggregate_id', 'string', ['length' => 50]);
     }
     if (!$table->hasColumn('version')) {
         $table->addColumn('version', 'integer');
     }
     if (!$table->hasColumn('type')) {
         $table->addColumn('type', 'string', ['length' => 100]);
     }
     if (!$table->hasColumn('payload')) {
         $table->addColumn('payload', 'text');
     }
     if (!$table->hasColumn('recorded_on')) {
         $table->addColumn('recorded_on', 'string', ['length' => 50]);
     }
     $table->addUniqueIndex(['aggregate_id', 'version']);
 }
Пример #30
0
 /**
  * Create orob2b_websites_locales table
  *
  * @param Schema $schema
  */
 protected function createOrob2BWebsitesLocalesTable(Schema $schema)
 {
     $table = $schema->createTable('orob2b_websites_locales');
     $table->addColumn('website_id', 'integer', []);
     $table->addColumn('locale_id', 'integer', []);
     $table->setPrimaryKey(['website_id', 'locale_id']);
 }