Example #1
0
 public function testDropPrimaryKey()
 {
     $table = new Table('test');
     $this->assertFalse($table->hasPrimaryKeyToDrop());
     $this->assertInstanceOf('\\Phoenix\\Database\\Element\\Table', $table->dropPrimaryKey());
     $this->assertTrue($table->hasPrimaryKeyToDrop());
 }
Example #2
0
 protected function dropKeys(Table $table, $primaryKeyName, $foreignKeyPrefix)
 {
     $queries = [];
     if ($table->hasPrimaryKeyToDrop()) {
         $queries[] = $this->dropKeyQuery($table, $primaryKeyName);
     }
     foreach ($table->getForeignKeysToDrop() as $foreignKey) {
         $queries[] = $this->dropKeyQuery($table, $foreignKeyPrefix . ' ' . $this->escapeString($foreignKey));
     }
     return $queries;
 }