Derek Organ
Derek Organ

Reputation: 8473

Yii MySQL DB Migration trying to use SQLite

I'm creating a test application with Yii and have created my first migration.

<?php

class m111128_223507_reverse_bed_patient extends CDbMigration
{
public function up()
{

    $this->dropForeignKey('fk_bed_patient1', 'bed');
    $this->dropColumn('bed', 'patient_id');
    $this->addColumn('patient', 'bed_id', 'int(11)');
    $this->addForeignKey('fk_patient_bed1', 'patient', 'bed_id', 'bed', 'id', 'NO ACTION', 'NO ACTION');

}

public function down()
{
    echo "m111128_223507_reverse_bed_patient does not support migration down.\n";
    return false;
}

}

for some reason Yii thinks I'm using a SQLite db even though in my app main.php I have MySQL settings which works correctly everywhere else and the SQLite lines commented out.

I'm getting this error when I try my first migrate.

* applying m111128_223507_reverse_bed_patient drop column patient_id from table bed ...exception 'CDbException' with message 'Dropping DB column is not supported by SQLite.' in ..

What am I missing here?

Upvotes: 1

Views: 784

Answers (1)

Alex Z
Alex Z

Reputation: 335

Probably your yiic tool is using console.php config file (as it is by default in Yii), try to review DB connection settings in protected/config/console.php.

Upvotes: 4

Related Questions