/** @test */ public function it_will_create_sequence() { $connection = $this->getConnection(); $sequence = new Sequence($connection); $connection->shouldReceive('statement')->andReturn(true); $success = $sequence->create('users_id_seq'); $this->assertEquals(true, $success); }
/** * create sequence and trigger for autoIncrement support * * @param Blueprint $blueprint * @param string $table * @return null */ public function createAutoIncrementObjects(Blueprint $blueprint, $table) { $column = $this->getQualifiedAutoIncrementColumn($blueprint); // return if no qualified AI column if (is_null($column)) { return; } $col = $column->name; $start = isset($column->start) ? $column->start : 1; // get table prefix $prefix = $this->connection->getTablePrefix(); // create sequence for auto increment $sequenceName = $this->createObjectName($prefix, $table, $col, 'seq'); $this->sequence->create($sequenceName, $start, $column->nocache); // create trigger for auto increment work around $triggerName = $this->createObjectName($prefix, $table, $col, 'trg'); $this->trigger->autoIncrement($prefix . $table, $col, $triggerName, $sequenceName); }