本文整理汇总了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;
}
示例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);
}
示例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));
}
示例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'));
}
示例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);
}
示例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");
}
示例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'));
}
示例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;
}