Yii Framework Forum: [Resolved] Apply Migration To Fixture - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[Resolved] Apply Migration To Fixture Rate Topic: -----

#1 User is offline   seb7 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 49
  • Joined: 03-April 12

Posted 18 May 2013 - 04:30 PM

hi

i've created my first migration using cdbmigration.
it's ok for the main database.
But I can't apply that migration to the fixtures database.
I changed the config/console.php to use the fixture db but then migration fails :
Apply the above migration? (yes|no) [no]:y
*** applying m130518_202259_rename_party_user_registration_status_to_registration_status_id
PHP Error[2]: include(m130518_202259_rename_party_user_registration_status_to_registration_status_id.php): failed to open stream: No such file or directory
    in file /data/htdocs/yii-1.1.13.e9e4a0/framework/YiiBase.php at line 421
#0 /data/htdocs/yii-1.1.13.e9e4a0/framework/YiiBase.php(421): autoload()
#1 unknown(0): autoload()
#2 /data/htdocs/yii-1.1.13.e9e4a0/framework/cli/commands/MigrateCommand.php(429): spl_autoload_call()
#3 /data/htdocs/yii-1.1.13.e9e4a0/framework/cli/commands/MigrateCommand.php(384): MigrateCommand->instantiateMigration()


if I cd in migration
seb@port party2  @ master $ cd protected/migrations/
seb@port migrations  @ master $ ../yiic migrate


Apply the above migration? (yes|no) [no]:y
*** applying m130518_202259_rename_party_user_registration_status_to_registration_status_id
PHP Fatal error:  Cannot redeclare class m130518_202259_rename_party_user_registration_status_id_to_registration_status_id_id in /data/htdocs/perso/party2/protected/migrations/m130518_202259_rename_party_user_registration_status_to_registration_status_id.php on line 27


Did someone succed applying a migration to a fixture database ?
0

#2 User is offline   seb7 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 49
  • Joined: 03-April 12

  Posted 19 May 2013 - 04:44 PM

File not found problems were because i renamed the migration files (or filename was too long or ?)

For the rest, i add a second connexion to /config/console.php

        'db' => array(
            'connectionString' => 'mysql:host=localhost;dbname=party',
            ...
        ),
        'dbtest' => array(
            'class'=>'CDbConnection',
            'connectionString' => 'mysql:host=localhost;dbname=party_fixture',
            ...
        ),


then i can run migration on test db using
./protected/yiic migrate --connectionID=dbtest

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users