Exemplo n.º 1
0
 /** @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);
 }
 /**
  * drop sequence and triggers if exists, autoincrement objects
  *
  * @param  string $table
  * @return null
  */
 public function dropAutoIncrementObjects($table)
 {
     // drop sequence and trigger object
     $prefix = $this->connection->getTablePrefix();
     // get the actual primary column name from table
     $col = $this->getPrimaryKey($prefix . $table);
     // if primary key col is set, drop auto increment objects
     if (isset($col) and !empty($col)) {
         // drop sequence for auto increment
         $sequenceName = $this->createObjectName($prefix, $table, $col, 'seq');
         $this->sequence->drop($sequenceName);
         // drop trigger for auto increment work around
         $triggerName = $this->createObjectName($prefix, $table, $col, 'trg');
         $this->trigger->drop($triggerName);
     }
 }