XF 2.2 Drop Column On Uninstall

Andy R

Member
I have some code in one of my install steps:
Code:
if (!$this->schemaManager()->columnExists('xf_user', 'token'))
{
    $table->addColumn('token', 'text')->nullable(true);
}

Is there a way to drop columns on uninstall()? Example:

Code:
if ($this->schemaManager()->columnExists('xf_user', 'token'))
{
    $table->removeColumn('token', 'text');
}
 
Yeah:

PHP:
$table->dropColumns('token');

You shouldn't need to guard the changes with existence checks. If the schema already matches then it shouldn't have any effect.
 
Back
Top Bottom