当前位置: 首页>>代码示例>>PHP>>正文


PHP Table::dropIndex方法代码示例

本文整理汇总了PHP中Doctrine\DBAL\Schema\Table::dropIndex方法的典型用法代码示例。如果您正苦于以下问题:PHP Table::dropIndex方法的具体用法?PHP Table::dropIndex怎么用?PHP Table::dropIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Doctrine\DBAL\Schema\Table的用法示例。


在下文中一共展示了Table::dropIndex方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testDropIndex

 /**
  * @group DBAL-224
  */
 public function testDropIndex()
 {
     $table = new Table("test");
     $table->addColumn('id', 'integer');
     $table->addIndex(array('id'), 'idx');
     $this->assertTrue($table->hasIndex('idx'));
     $table->dropIndex('idx');
     $this->assertFalse($table->hasIndex('idx'));
 }
开发者ID:llinder,项目名称:FrameworkBenchmarks,代码行数:12,代码来源:TableTest.php

示例2: renameIndex

 /**
  * @param Schema $schema
  * @param QueryBag $queries
  * @param string $tableName
  * @param string $columnName
  * @param array $options
  * @param string $className
  * @param Table $table
  */
 protected function renameIndex(Schema $schema, QueryBag $queries, $tableName, $columnName, $options, $className, $table)
 {
     $newColumnName = $options[ExtendOptionsManager::NEW_NAME_OPTION];
     $indexName = $this->nameGenerator->generateIndexNameForExtendFieldVisibleInGrid($className, $columnName);
     if ($table->hasIndex($indexName)) {
         $table->dropIndex($indexName);
         $newIndexName = $this->nameGenerator->generateIndexNameForExtendFieldVisibleInGrid($className, $newColumnName);
         $this->renameExtension->addIndex($schema, $queries, $tableName, [$newColumnName], $newIndexName);
     }
 }
开发者ID:Maksold,项目名称:platform,代码行数:19,代码来源:UpdateExtendIndicesMigration.php

示例3: testNormalizesColumnNames

 /**
  * @dataProvider getNormalizesAssetNames
  * @group DBAL-831
  */
 public function testNormalizesColumnNames($assetName)
 {
     $table = new Table('test');
     $table->addColumn($assetName, 'integer');
     $table->addIndex(array($assetName), $assetName);
     $table->addForeignKeyConstraint('test', array($assetName), array($assetName), array(), $assetName);
     $this->assertTrue($table->hasColumn($assetName));
     $this->assertTrue($table->hasColumn('foo'));
     $this->assertInstanceOf('Doctrine\\DBAL\\Schema\\Column', $table->getColumn($assetName));
     $this->assertInstanceOf('Doctrine\\DBAL\\Schema\\Column', $table->getColumn('foo'));
     $this->assertTrue($table->hasIndex($assetName));
     $this->assertTrue($table->hasIndex('foo'));
     $this->assertInstanceOf('Doctrine\\DBAL\\Schema\\Index', $table->getIndex($assetName));
     $this->assertInstanceOf('Doctrine\\DBAL\\Schema\\Index', $table->getIndex('foo'));
     $this->assertTrue($table->hasForeignKey($assetName));
     $this->assertTrue($table->hasForeignKey('foo'));
     $this->assertInstanceOf('Doctrine\\DBAL\\Schema\\ForeignKeyConstraint', $table->getForeignKey($assetName));
     $this->assertInstanceOf('Doctrine\\DBAL\\Schema\\ForeignKeyConstraint', $table->getForeignKey('foo'));
     $table->renameIndex($assetName, $assetName);
     $this->assertTrue($table->hasIndex($assetName));
     $this->assertTrue($table->hasIndex('foo'));
     $table->renameIndex($assetName, 'foo');
     $this->assertTrue($table->hasIndex($assetName));
     $this->assertTrue($table->hasIndex('foo'));
     $table->renameIndex('foo', $assetName);
     $this->assertTrue($table->hasIndex($assetName));
     $this->assertTrue($table->hasIndex('foo'));
     $table->renameIndex($assetName, 'bar');
     $this->assertFalse($table->hasIndex($assetName));
     $this->assertFalse($table->hasIndex('foo'));
     $this->assertTrue($table->hasIndex('bar'));
     $table->renameIndex('bar', $assetName);
     $table->dropColumn($assetName);
     $table->dropIndex($assetName);
     $table->removeForeignKey($assetName);
     $this->assertFalse($table->hasColumn($assetName));
     $this->assertFalse($table->hasColumn('foo'));
     $this->assertFalse($table->hasIndex($assetName));
     $this->assertFalse($table->hasIndex('foo'));
     $this->assertFalse($table->hasForeignKey($assetName));
     $this->assertFalse($table->hasForeignKey('foo'));
 }
开发者ID:selimcr,项目名称:servigases,代码行数:46,代码来源:TableTest.php

示例4: dropIndex

 /**
  * Drop an index
  *
  * @param   string  $name  index name
  * @return  $this
  */
 public function dropIndex($name)
 {
     $this->table->dropIndex($name);
     return $this;
 }
开发者ID:DoctorSanchez,项目名称:database,代码行数:11,代码来源:Table.php

示例5: removeForeignKeyAndIndex

 /**
  * @param \Doctrine\DBAL\Schema\Table $table
  * @param string $name
  */
 private function removeForeignKeyAndIndex(\Doctrine\DBAL\Schema\Table $table, $name)
 {
     $table->removeForeignKey($name);
     $table->dropIndex(str_replace('FK', 'IDX', $name));
 }
开发者ID:baszoetekouw,项目名称:janus,代码行数:9,代码来源:Version20130715061941AddForeignKeyConstraints.php


注:本文中的Doctrine\DBAL\Schema\Table::dropIndex方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。