public function testDropPrimaryKey() { $table = new Table('test'); $this->assertFalse($table->hasPrimaryKeyToDrop()); $this->assertInstanceOf('\\Phoenix\\Database\\Element\\Table', $table->dropPrimaryKey()); $this->assertTrue($table->hasPrimaryKeyToDrop()); }
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; }