本文整理汇总了PHP中Doctrine\DBAL\Schema\Schema类的典型用法代码示例。如果您正苦于以下问题:PHP Schema类的具体用法?PHP Schema怎么用?PHP Schema使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Schema类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: oroReminderTable
/**
* 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 **/
}
开发者ID:Maksold,项目名称:platform,代码行数:32,代码来源:OroReminderBundle.php
示例2: createAuditField
/**
* @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]);
}
开发者ID:nmallare,项目名称:platform,代码行数:28,代码来源:OroDataAuditBundle.php
示例3: preUp
/**
* @param Schema $schema
*
* @throws SkipMigrationException
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function preUp(Schema $schema)
{
$pageHitTable = $schema->getTable($this->prefix . 'users');
if ($pageHitTable->hasColumn('signature')) {
throw new SkipMigrationException('Schema includes this migration');
}
}
开发者ID:HomeRefill,项目名称:mautic,代码行数:13,代码来源:Version20160225000000.php
示例4: modifyChannelTable
/**
* Change oro_integration_channel table
*
* @param Schema $schema
*/
public static function modifyChannelTable(Schema $schema)
{
$table = $schema->getTable('oro_integration_channel');
$table->addColumn('default_user_owner_id', 'integer', ['notnull' => false]);
$table->addIndex(['default_user_owner_id'], 'IDX_55B9B9C5A89019EA', []);
$table->addForeignKeyConstraint($schema->getTable('oro_user'), ['default_user_owner_id'], ['id'], ['onDelete' => 'SET NULL', 'onUpdate' => null], 'FK_55B9B9C5A89019EA');
}
开发者ID:Maksold,项目名称:platform,代码行数:12,代码来源:OroIntegrationBundle.php
示例5: addOrob2BShoppingListLineItemForeignKeys
/**
* Add orob2b_shopping_list_line_item foreign keys.
*
* @param Schema $schema
*/
protected function addOrob2BShoppingListLineItemForeignKeys(Schema $schema)
{
$table = $schema->getTable('orob2b_shopping_list_line_item');
$table->addForeignKeyConstraint($schema->getTable('orob2b_shopping_list'), ['shopping_list_id'], ['id'], ['onDelete' => 'CASCADE', 'onUpdate' => null]);
$table->addForeignKeyConstraint($schema->getTable('orob2b_product'), ['product_id'], ['id'], ['onDelete' => 'CASCADE', 'onUpdate' => null]);
$table->addForeignKeyConstraint($schema->getTable('orob2b_product_unit'), ['unit_code'], ['code'], ['onDelete' => 'CASCADE', 'onUpdate' => null]);
}
开发者ID:hafeez3000,项目名称:orocommerce,代码行数:12,代码来源:OroB2BShoppingListBundleInstaller.php
示例6: addAttachmentRelation
/**
* @param Schema $schema
*
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public static function addAttachmentRelation(Schema $schema)
{
$table = $schema->getTable('oro_email_attachment');
$table->addColumn('file_id', 'integer', ['notnull' => false]);
$table->addUniqueIndex(['file_id'], 'UNIQ_F4427F2393CB796C');
$table->addForeignKeyConstraint($schema->getTable('oro_attachment_file'), ['file_id'], ['id'], ['onDelete' => 'SET NULL'], 'FK_F4427F2393CB796C');
}
开发者ID:ramunasd,项目名称:platform,代码行数:12,代码来源:OroEmailBundle.php
示例7: up
/**
* {@inheritdoc}
*/
public function up(Schema $schema, QueryBag $queries)
{
$table = $schema->getTable('oro_calendar_event');
$table->dropColumn('reminder');
$table->dropColumn('remind_at');
$table->dropColumn('reminded');
}
开发者ID:Maksold,项目名称:platform,代码行数:10,代码来源:DropCalendarEventColumns.php
示例8: down
public function down(Schema $schema)
{
// remove website creationmode and ismarkedfordeletion column
$schema->getTable('website')->dropColumn('share');
$schema->getTable('website')->dropColumn('creationmode');
$schema->getTable('website')->dropColumn('ismarkedfordeletion');
}
开发者ID:rukzuk,项目名称:rukzuk,代码行数:7,代码来源:Version20130614120447.php
示例9: addToSchema
/**
* @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']);
}
开发者ID:hellofresh,项目名称:engine,代码行数:34,代码来源:DbalSchema.php
示例10: getSqlDiffToMigrate
/**
* @param Schema $fromSchema
* @param Schema $toSchema
*
* @return string[]
*/
public function getSqlDiffToMigrate(Schema $fromSchema, Schema $toSchema)
{
if ($toSchema instanceof LazyLoadingInterface && !$toSchema->isProxyInitialized()) {
return [];
}
return $this->originalSchemaManipulator->getSqlDiffToMigrate($fromSchema, $toSchema);
}
开发者ID:doctrine,项目名称:migrations,代码行数:13,代码来源:LazySchemaDiffProvider.php
示例11: addOwner
/**
* Adds owner_id field
*
* @param Schema $schema
*/
public static function addOwner(Schema $schema)
{
$table = $schema->getTable('oro_embedded_form');
$table->addColumn('owner_id', 'integer', ['notnull' => false]);
$table->addIndex(['owner_id'], 'IDX_F7A34C17E3C61F9', []);
$table->addForeignKeyConstraint($schema->getTable('oro_organization'), ['owner_id'], ['id'], ['onDelete' => 'SET NULL', 'onUpdate' => null]);
}
开发者ID:Maksold,项目名称:platform,代码行数:12,代码来源:OroEmbeddedFormBundle.php
示例12: up
/**
* {@inheritdoc}
*/
public function up(Schema $schema, QueryBag $queries)
{
$table = $schema->getTable('oro_reminder');
$table->addColumn('sender_id', 'integer', ['notnull' => false]);
$table->addIndex(['sender_id'], 'idx_2f4f9f57f624b39d', []);
$table->addForeignKeyConstraint($schema->getTable('oro_user'), ['sender_id'], ['id'], ['onUpdate' => null, 'onDelete' => 'SET NULL']);
}
开发者ID:Maksold,项目名称:platform,代码行数:10,代码来源:AddReminderSender.php
示例13: updateOroEmailUserTable
/**
* Add origin to EmailUser
*
* @param Schema $schema
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public static function updateOroEmailUserTable(Schema $schema)
{
$table = $schema->getTable('oro_email_user');
$table->removeForeignKey('fk_91f5cff6162cb942');
$table->dropIndex('idx_91f5cff6162cb942');
$table->addColumn('origin_id', 'integer', ['notnull' => false]);
}
开发者ID:ramunasd,项目名称:platform,代码行数:13,代码来源:ChangeEmailUserFolderRelation.php
示例14: 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()));
}
}
开发者ID:Maksold,项目名称:platform,代码行数:44,代码来源:ChangeTypeExtension.php
示例15: modifycOrocrmContactusRequestTable
/**
* @param Schema $schema
*/
protected function modifycOrocrmContactusRequestTable(Schema $schema)
{
$table = $schema->getTable('orocrm_contactus_request');
$table->addColumn('data_channel_id', 'integer', ['notnull' => false]);
$table->addIndex(['data_channel_id'], 'IDX_342872E8BDC09B73', []);
$table->addForeignKeyConstraint($schema->getTable('orocrm_channel'), ['data_channel_id'], ['id'], ['onDelete' => 'SET NULL', 'onUpdate' => null], 'FK_342872E8BDC09B73');
}
开发者ID:antrampa,项目名称:crm,代码行数:10,代码来源:OroCRMContactUsBundle.php
示例16: preUp
/**
* @param Schema $schema
*
* @throws SkipMigrationException
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function preUp(Schema $schema)
{
$table = $schema->getTable($this->prefix . 'oauth2_accesstokens');
if ($table->hasIndex(MAUTIC_TABLE_PREFIX . 'oauth2_access_token_search')) {
throw new SkipMigrationException('Schema includes this migration');
}
}
开发者ID:Yame-,项目名称:mautic,代码行数:13,代码来源:Version20160630000000.php
示例17: addOwnerFields
/**
* @param Schema $schema
*/
public static function addOwnerFields(Schema $schema)
{
$table = $schema->getTable('test_activity');
$table->addColumn('owner_id', 'integer', ['notnull' => false]);
$table->addIndex(['owner_id']);
$table->addForeignKeyConstraint($schema->getTable('oro_user'), ['owner_id'], ['id'], ['onDelete' => 'SET NULL', 'onUpdate' => null]);
}
开发者ID:Maksold,项目名称:platform,代码行数:10,代码来源:OroTestFrameworkBundle.php
示例18: up
/**
* {@inheritdoc}
*/
public function up(Schema $schema, QueryBag $queries)
{
$table = $schema->getTable('orocrm_magento_customer');
$table->addColumn('rfm_recency', 'integer', ['notnull' => false]);
$table->addColumn('rfm_frequency', 'integer', ['notnull' => false]);
$table->addColumn('rfm_monetary', 'integer', ['notnull' => false]);
}
开发者ID:antrampa,项目名称:crm,代码行数:10,代码来源:AddRFMMetrics.php
示例19: up
/**
* @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']);
}
开发者ID:cultuurnet,项目名称:udb3-silex,代码行数:10,代码来源:Version20151029184516.php
示例20: addOroActivityOwnerForeignKeys
/**
* Add oro_activity_owner foreign keys.
*
* @param Schema $schema
*/
protected static function addOroActivityOwnerForeignKeys(Schema $schema)
{
$table = $schema->getTable('oro_activity_owner');
$table->addForeignKeyConstraint($schema->getTable('oro_user'), ['user_id'], ['id'], ['onDelete' => null, 'onUpdate' => null]);
$table->addForeignKeyConstraint($schema->getTable('oro_organization'), ['organization_id'], ['id'], ['onDelete' => null, 'onUpdate' => null]);
$table->addForeignKeyConstraint($schema->getTable('oro_activity_list'), ['activity_id'], ['id'], ['onDelete' => 'CASCADE', 'onUpdate' => null]);
}
开发者ID:ramunasd,项目名称:platform,代码行数:12,代码来源:AddActivityOwner.php
注:本文中的Doctrine\DBAL\Schema\Schema类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论