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


PHP Schema::createSequence方法代码示例

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


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

示例1: createFixtureSchema

 /**
  * @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;
 }
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:17,代码来源:SchemaSqlCollectorTest.php

示例2: testAutoIncremenetSequences

 /**
  * @group DDC-1657
  */
 public function testAutoIncremenetSequences()
 {
     $oldSchema = new Schema();
     $table = $oldSchema->createTable("foo");
     $table->addColumn("id", "integer", array("autoincrement" => true));
     $table->setPrimaryKey(array("id"));
     $oldSchema->createSequence("foo_id_seq");
     $newSchema = new Schema();
     $table = $newSchema->createTable("foo");
     $table->addColumn("id", "integer", array("autoincrement" => true));
     $table->setPrimaryKey(array("id"));
     $c = new Comparator();
     $diff = $c->compare($oldSchema, $newSchema);
     $this->assertCount(0, $diff->removedSequences);
 }
开发者ID:llinder,项目名称:FrameworkBenchmarks,代码行数:18,代码来源:ComparatorTest.php

示例3: testVisitsNamespaceVisitor

 /**
  * @group DBAL-669
  */
 public function testVisitsNamespaceVisitor()
 {
     $schema = new Schema();
     $visitor = $this->getMock('Doctrine\\DBAL\\Schema\\Visitor\\AbstractVisitor');
     $schema->createNamespace('foo');
     $schema->createNamespace('bar');
     $schema->createTable('baz');
     $schema->createTable('bla.bloo');
     $schema->createSequence('moo');
     $schema->createSequence('war');
     $visitor->expects($this->once())->method('acceptSchema')->with($schema);
     $visitor->expects($this->at(1))->method('acceptNamespace')->with('foo');
     $visitor->expects($this->at(2))->method('acceptNamespace')->with('bar');
     $visitor->expects($this->at(3))->method('acceptNamespace')->with('bla');
     $visitor->expects($this->exactly(3))->method('acceptNamespace');
     $visitor->expects($this->at(4))->method('acceptTable')->with($schema->getTable('baz'));
     $visitor->expects($this->at(5))->method('acceptTable')->with($schema->getTable('bla.bloo'));
     $visitor->expects($this->exactly(2))->method('acceptTable');
     $visitor->expects($this->at(6))->method('acceptSequence')->with($schema->getSequence('moo'));
     $visitor->expects($this->at(7))->method('acceptSequence')->with($schema->getSequence('war'));
     $visitor->expects($this->exactly(2))->method('acceptSequence');
     $this->assertNull($schema->visit($visitor));
 }
开发者ID:selimcr,项目名称:servigases,代码行数:26,代码来源:SchemaTest.php

示例4: testChangedSequence

 /**
  * @group DBAL-112
  */
 public function testChangedSequence()
 {
     $schema = new Schema();
     $sequence = $schema->createSequence('baz');
     $schemaNew = clone $schema;
     /* @var $schemaNew Schema */
     $schemaNew->getSequence('baz')->setAllocationSize(20);
     $c = new \Doctrine\DBAL\Schema\Comparator();
     $diff = $c->compare($schema, $schemaNew);
     $this->assertSame($diff->changedSequences[0], $schemaNew->getSequence('baz'));
 }
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:14,代码来源:ComparatorTest.php

示例5: testSequencesCaseInsenstive

 public function testSequencesCaseInsenstive()
 {
     $schemaA = new Schema();
     $schemaA->createSequence('foo');
     $schemaA->createSequence('BAR');
     $schemaA->createSequence('Baz');
     $schemaA->createSequence('new');
     $schemaB = new Schema();
     $schemaB->createSequence('FOO');
     $schemaB->createSequence('Bar');
     $schemaB->createSequence('baz');
     $schemaB->createSequence('old');
     $c = new Comparator();
     $diff = $c->compare($schemaA, $schemaB);
     $this->assertSchemaSequenceChangeCount($diff, 1, 0, 1);
 }
开发者ID:faridos,项目名称:ServerGroveLiveChat,代码行数:16,代码来源:ComparatorTest.php

示例6: createPlgplgSendHistorySendIdSeq

 /**
  * plg_send_history_send_id_seqの作成
  * @param Schema $schema
  */
 protected function createPlgplgSendHistorySendIdSeq(Schema $schema)
 {
     $seq = $schema->createSequence("plg_send_history_send_id_seq");
 }
开发者ID:sai-ken-tanaka,项目名称:mail-magazine-plugin,代码行数:8,代码来源:Version201508072300.php

示例7: testDeepClone

 public function testDeepClone()
 {
     $schema = new Schema();
     $sequence = $schema->createSequence('baz');
     $tableA = $schema->createTable('foo');
     $tableA->addColumn('id', 'integer');
     $tableB = $schema->createTable('bar');
     $tableB->addColumn('id', 'integer');
     $tableB->addColumn('foo_id', 'integer');
     $tableB->addForeignKeyConstraint($tableA, array('foo_id'), array('id'));
     $schemaNew = clone $schema;
     $this->assertNotSame($sequence, $schemaNew->getSequence('baz'));
     $this->assertNotSame($tableA, $schemaNew->getTable('foo'));
     $this->assertNotSame($tableA->getColumn('id'), $schemaNew->getTable('foo')->getColumn('id'));
     $this->assertNotSame($tableB, $schemaNew->getTable('bar'));
     $this->assertNotSame($tableB->getColumn('id'), $schemaNew->getTable('bar')->getColumn('id'));
     $fk = $schemaNew->getTable('bar')->getForeignKeys();
     $fk = current($fk);
     $this->assertSame($schemaNew->getTable('bar'), $this->readAttribute($fk, '_localTable'));
 }
开发者ID:marchyoung,项目名称:FrameworkBenchmarks,代码行数:20,代码来源:SchemaTest.php

示例8: _handlePrimaryKey

 protected function _handlePrimaryKey(Schema $schema, $tableName, $sequenceName = null)
 {
     $columnOptions = array();
     if ($this->conn->getDatabasePlatform()->prefersIdentityColumns()) {
         $columnOptions = array('autoincrement' => true);
     } elseif ($this->conn->getDatabasePlatform()->prefersSequences()) {
         $sequence = $schema->createSequence($sequenceName);
         // Doens't work because of the ordering used by Doctrine in dropping tables.
         //$columnOptions = array( 'default' => "nextval('" . $sequenceName . "')" );
     }
     return $columnOptions;
 }
开发者ID:beberlei,项目名称:Doctrine-Workflow,代码行数:12,代码来源:SchemaBuilder.php


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