Yii Framework Forum: [extension] Yii DB Migrations - very early alpha release - Yii Framework Forum

Jump to content

  • (3 Pages)
  • +
  • 1
  • 2
  • 3
  • You cannot start a new topic
  • You cannot reply to this topic

[extension] Yii DB Migrations - very early alpha release Rate Topic: -----

#21 User is offline   pclaerhout 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 25
  • Joined: 08-December 08

Posted 30 August 2009 - 08:43 AM

View Postme23, on 14 August 2009 - 03:53 PM, said:

Hi,

i have a little feature request:
I would like to configure more databases for
one project e.g production, testing, development
and therefore i need the opportunity to migrate
to given version and given environment e.g.
yiic migrate env=testing for migrating the testing database

Thanks for sharing your great work!

Greetings from Germany

me23


I'm doing something like that in my own applications. In the index.php and yiic.php scripts, I've added a check to see if I'm in the development or production environment. Based on that, I'm setting the YII_DEBUG constant.

Additionally, in the config files, I'm checking if YII_DEBUG is true or not and include the correct database configuration file.

Depending on how you distinguish the development from the production system, you will need a different kind of check.

For me, the rule is:

  • For index.php: if the server name is localhost, I'm in the development environment
  • For yiic.php: I'm checking for the existance of an environment variable that indicates the enviroment


Cheers,


pieter
0

#22 User is offline   pclaerhout 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 25
  • Joined: 08-December 08

Posted 30 August 2009 - 08:45 AM

View PostGodFather, on 16 August 2009 - 04:51 PM, said:

Actually I'm using a older version of this extension.

How can I update this extencion in my aplications? Just overwrite the classes in extensio directory?

Thanks.


Yes, you can just replace the entire yii-dbmigrations directory with the new version.

Regards,

pieter
0

#23 User is offline   Q-efx 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 62
  • Joined: 12-April 09

Posted 14 September 2009 - 11:35 AM

Note: If you are on in windows, and from germany, you have to set the right timezone :)

Suggestion: Why not change those "hundred" array`s to something like this:

public function up
{
    $this->createTable(
        'tablename: field1 :: type1,
                    field2 :: type2,
                    field3 :: type3'
    )

}


Speed shouldn't have a big impact, and would look much cleaner :)
----------------------------------------------------
United-Regions-OFP

A social development project  ( In development ;-) )
----------------------------------------------------
0

#24 User is offline   pclaerhout 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 25
  • Joined: 08-December 08

Posted 14 September 2009 - 01:16 PM

View PostQ-efx, on 14 September 2009 - 11:35 AM, said:

Note: If you are on in windows, and from germany, you have to set the right timezone :)

Suggestion: Why not change those "hundred" array`s to something like this:

public function up
{
    $this->createTable(
        'tablename: field1 :: type1,
                    field2 :: type2,
                    field3 :: type3'
    )

}


Speed shouldn't have a big impact, and would look much cleaner :)


I will see what I can do for version 2.0 to make it less verbose.

pieter
0

#25 User is offline   Ramin 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 13
  • Joined: 08-February 09

Posted 16 September 2009 - 01:55 AM

View Postpclaerhout, on 14 August 2009 - 02:55 PM, said:

If you download the latest version from github, you will see that I added a new command that creates a blank migration:

protected yiic migrate create MyTestMigration


That will create the timestamped file with an empty migration in there.

Regards,


pieter


Hello Pieter,

I am getting the following error message after running "protected/yiic migrate -create mymigration":

ERROR: Invalid migration: -create

It seems the "create" option is not implemented or I am using a wrong version.

Thanks,
Ramin
0

#26 User is offline   pclaerhout 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 25
  • Joined: 08-December 08

Posted 16 September 2009 - 01:59 AM

View PostRamin, on 16 September 2009 - 01:55 AM, said:

Hello Pieter,

I am getting the following error message after running "protected/yiic migrate -create mymigration":

ERROR: Invalid migration: -create

It seems the "create" option is not implemented or I am using a wrong version.

Thanks,
Ramin


You've made an error in the command. You should use the following (without the dash in front of the create command):

protected/yiic migrate create mymigration


Cheers,


pieter
0

#27 User is offline   Ramin 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 13
  • Joined: 08-February 09

Posted 16 September 2009 - 06:06 PM

View Postpclaerhout, on 16 September 2009 - 01:59 AM, said:

You've made an error in the command. You should use the following (without the dash in front of the create command):

protected/yiic migrate create mymigration


Cheers,


pieter


The dash was a typo when I replied to your post. This is what I've got:

ramin$ protected/yiic migrate create mymigration
ERROR: Invalid migration: create
ramin$

Thanks,
Ramin
0

#28 User is offline   Ramin 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 13
  • Joined: 08-February 09

Posted 19 September 2009 - 04:39 PM

View PostRamin, on 16 September 2009 - 06:06 PM, said:

The dash was a typo when I replied to your post. This is what I've got:

ramin$ protected/yiic migrate create mymigration
ERROR: Invalid migration: create
ramin$

Thanks,
Ramin


The 'timestamp' type mapping creates 'datetime' type.

Regards,
Ramin
0

#29 User is offline   GodFather 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 91
  • Joined: 19-July 09

Posted 22 October 2009 - 08:32 PM

Hi guys,
I'm having some problens when I try to create new migrations.

I created a new application using version 1.0.10 of yii, and when I try create a new migration, the console show this error:

Migrations directory: protected/migrations/

Creating initial schema_version table
PHP Error[2]: PDOStatement::execute() expects parameter 1 to be array, string given
in file /Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/yii/db/CDbCommand.php at line 352
#0  CConsoleApplication->displayError(2, PDOStatement::execute() expects parameter 1 to be array, string given, /Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/yii/db/CDbCommand.php, 352) called at [/Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/yii/base/CErrorHandler.php:204]
#1  CErrorHandler->handleError(CErrorEvent Object ([code] => 2,[message] => PDOStatement::execute() expects parameter 1 to be array, string given,[file] => /Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/yii/db/CDbCommand.php,[line] => 352,[sender] => CConsoleApplication Object ([commandMap] => Array ([migrate] => Array ([class] => application.extensions.yii-dbmigrations.CDbMigrationCommand)),[] => /Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/public/protected/commands,[] => CConsoleCommandRunner Object ([commands] => Array ([migrate] => Array ([class] => application.extensions.yii-dbmigrations.CDbMigrationCommand),[message] => /Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/yii/cli/commands/MessageCommand.php,[shell] => /Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/yii/cli/commands/ShellCommand.php,[webapp] => /Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/yii/cli/commands/WebAppCommand.php),[] => ./protected/yiic,[] => ,[] => ),[name] => My Console Application,[charset] => UTF-8,[sourceLanguage] => en_us,[] => ,[] => /Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/public/protected,[] => ,[] => ,[] => ,[] => ,[] => ,[] => ,[preload] => Array (),[behaviors] => Array (),[] => ,[] => ,[] => ,[] => ,[] => ,[] => Array (),[] => Array (),[] => Array ([db] => CDbConnection Object ([connectionString] => mysql:host=localhost;dbname=nagloria;unix_socket=/tmp/mysql.sock,[username] => root,[password] => ,[schemaCachingDuration] => 0,[schemaCachingExclude] => Array (),[schemaCacheID] => cache,[autoConnect] => 1,[charset] => ,[emulatePrepare] => 1,[enableParamLogging] => ,[enableProfiling] => ,[] => Array (),[] => 1,[] => PDO Object (),[] => ,[] => CMysqlSchema Object ([] => ,[] => ,[] => Array (),[] => Array ([schema_version] => ),[] => CDbConnection Object ( *RECURSION*,[] => ,[] => Array (),[] => ,[] => ),[behaviors] => Array (),[] => 1,[] => ,[] => ),[coreMessages] => CPhpMessageSource Object ([cachingDuration] => 0,[cacheID] => cache,[basePath] => /Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/yii/messages,[] => Array (),[] => en_us,[] => Array (),[behaviors] => Array (),[] => 1,[] => ,[] => ),[errorHandler] => CErrorHandler Object ([maxSourceLines] => 25,[adminInfo] => the webmaster,[discardOutput] => 1,[errorAction] => ,[] => ,[behaviors] => Array (),[] => 1,[] => ,[] => )),[] => Array ([messages] => Array ([class] => CPhpMessageSource),[securityManager] => Array ([class] => CSecurityManager),[statePersister] => Array ([class] => CStatePersister),[urlManager] => Array ([class] => CUrlManager),[request] => Array ([class] => CHttpRequest)),[] => ,[] => ),[handled] => 1,[] => ,[] => )) called at [/Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/yii/base/CErrorHandler.php:96]
#2  CErrorHandler->handle(CErrorEvent Object ([code] => 2,[message] => PDOStatement::execute() expects parameter 1 to be array, string given,[file] => /Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/yii/db/CDbCommand.php,[line] => 352,[sender] => CConsoleApplication Object ([commandMap] => Array ([migrate] => Array ([class] => application.extensions.yii-dbmigrations.CDbMigrationCommand)),[] => /Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/public/protected/commands,[] => CConsoleCommandRunner Object ([commands] => Array ([migrate] => Array ([class] => application.extensions.yii-dbmigrations.CDbMigrationCommand),[message] => /Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/yii/cli/commands/MessageCommand.php,[shell] => /Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/yii/cli/commands/ShellCommand.php,[webapp] => /Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/yii/cli/commands/WebAppCommand.php),[] => ./protected/yiic,[] => ,[] => ),[name] => My Console Application,[charset] => UTF-8,[sourceLanguage] => en_us,[] => ,[] => /Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/public/protected,[] => ,[] => ,[] => ,[] => ,[] => ,[] => ,[preload] => Array (),[behaviors] => Array (),[] => ,[] => ,[] => ,[] => ,[] => ,[] => Array (),[] => Array (),[] => Array ([db] => CDbConnection Object ([connectionString] => mysql:host=localhost;dbname=nagloria;unix_socket=/tmp/mysql.sock,[username] => root,[password] => ,[schemaCachingDuration] => 0,[schemaCachingExclude] => Array (),[schemaCacheID] => cache,[autoConnect] => 1,[charset] => ,[emulatePrepare] => 1,[enableParamLogging] => ,[enableProfiling] => ,[] => Array (),[] => 1,[] => PDO Object (),[] => ,[] => CMysqlSchema Object ([] => ,[] => ,[] => Array (),[] => Array ([schema_version] => ),[] => CDbConnection Object ( *RECURSION*,[] => ,[] => Array (),[] => ,[] => ),[behaviors] => Array (),[] => 1,[] => ,[] => ),[coreMessages] => CPhpMessageSource Object ([cachingDuration] => 0,[cacheID] => cache,[basePath] => /Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/yii/messages,[] => Array (),[] => en_us,[] => Array (),[behaviors] => Array (),[] => 1,[] => ,[] => ),[errorHandler] => CErrorHandler Object ([maxSourceLines] => 25,[adminInfo] => the webmaster,[discardOutput] => 1,[errorAction] => ,[] => ,[behaviors] => Array (),[] => 1,[] => ,[] => )),[] => Array ([messages] => Array ([class] => CPhpMessageSource),[securityManager] => Array ([class] => CSecurityManager),[statePersister] => Array ([class] => CStatePersister),[urlManager] => Array ([class] => CUrlManager),[request] => Array ([class] => CHttpRequest)),[] => ,[] => ),[handled] => 1,[] => ,[] => )) called at [/Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/yii/base/CApplication.php:630]
#3  CApplication->handleError(2, PDOStatement::execute() expects parameter 1 to be array, string given, /Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/yii/db/CDbCommand.php, 352, Array ([this] => CDbCommand Object ([] => CDbConnection Object ([connectionString] => mysql:host=localhost;dbname=nagloria;unix_socket=/tmp/mysql.sock,[username] => root,[password] => ,[schemaCachingDuration] => 0,[schemaCachingExclude] => Array (),[schemaCacheID] => cache,[autoConnect] => 1,[charset] => ,[emulatePrepare] => 1,[enableParamLogging] => ,[enableProfiling] => ,[] => Array (),[] => 1,[] => PDO Object (),[] => ,[] => CMysqlSchema Object ([] => ,[] => ,[] => Array (),[] => Array ([schema_version] => ),[] => CDbConnection Object ( *RECURSION*,[] => ,[] => Array (),[] => ,[] => ),[behaviors] => Array (),[] => 1,[] => ,[] => ),[] => SELECT `id` FROM `schema_version` ORDER BY `id`,[] => PDOStatement Object ([queryString] => SELECT `id` FROM `schema_version` ORDER BY `id`),[] => Array (),[] => ,[] => ),[method] => fetchAll,[mode] => 7,[params] => id,[par] => ))
#4  PDOStatement->execute(id) called at [/Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/yii/db/CDbCommand.php:352]
#5  CDbCommand->queryInternal(fetchAll, 7, id) called at [/Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/yii/db/CDbCommand.php:321]
#6  CDbCommand->queryColumn(id) called at [/Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/public/protected/extensions/yii-dbmigrations/CDbMigrationEngine.php:187]
#7  CDbMigrationEngine->getAppliedMigrations() called at [/Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/public/protected/extensions/yii-dbmigrations/CDbMigrationEngine.php:295]
#8  CDbMigrationEngine->applyMigrations(create) called at [/Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/public/protected/extensions/yii-dbmigrations/CDbMigrationEngine.php:86]
#9  CDbMigrationEngine->run(Array ([0] => create,[1] => users)) called at [/Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/public/protected/extensions/yii-dbmigrations/CDbMigrationCommand.php:99]
#10 CDbMigrationCommand->run(Array ([0] => create,[1] => users)) called at [/Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/yii/console/CConsoleCommandRunner.php:62]
#11 CConsoleCommandRunner->run(Array ([0] => ./protected/yiic,[1] => migrate,[2] => create,[3] => users)) called at [/Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/yii/console/CConsoleApplication.php:88]
#12 CConsoleApplication->processRequest() called at [/Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/yii/base/CApplication.php:135]
#13 CApplication->run() called at [/Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/yii/yiic.php:31]
#14 require_once(/Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/yii/yiic.php) called at [/Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/public/protected/yiic.php:7]
#15 require_once(/Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/public/protected/yiic.php) called at [/Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/public/protected/yiic:4]



I 'm calling this line on command line:

$ ./protected/yiic migrate create users 


And the configuration is that:
'commandMap' => array('migrate' => array('class' => 'application.extensions.yii-dbmigrations.CDbMigrationCommand')),

'components' => array('db' => array('class' => 'system.db.CDbConnection', 
              		      'connectionString' => 'mysql:host=localhost;dbname=nagloria;unix_socket=/tmp/mysql.sock', 
              		      'username' => 'root', 
              		      'password' => '',
              		      'emulatePrepare' => true)),
	


I did some tests with version 1.0.8 of yii and the extansion run well, but with 1.0.10 the problem happened.
Could you help me to fix up this?
Thanks.
0

#30 User is offline   pclaerhout 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 25
  • Joined: 08-December 08

Posted 27 October 2009 - 03:36 AM

Please download the latest version from github. It has this problem fixed.

Regards,


pieter

View PostGodFather, on 22 October 2009 - 08:32 PM, said:

Hi guys,
I'm having some problens when I try to create new migrations.

I created a new application using version 1.0.10 of yii, and when I try create a new migration, the console show this error:

Migrations directory: protected/migrations/

Creating initial schema_version table
PHP Error[2]: PDOStatement::execute() expects parameter 1 to be array, string given
in file /Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/yii/db/CDbCommand.php at line 352
#0  CConsoleApplication->displayError(2, PDOStatement::execute() expects parameter 1 to be array, string given, /Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/yii/db/CDbCommand.php, 352) called at [/Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/yii/base/CErrorHandler.php:204]
#1  CErrorHandler->handleError(CErrorEvent Object ([code] => 2,[message] => PDOStatement::execute() expects parameter 1 to be array, string given,[file] => /Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/yii/db/CDbCommand.php,[line] => 352,[sender] => CConsoleApplication Object ([commandMap] => Array ([migrate] => Array ([class] => application.extensions.yii-dbmigrations.CDbMigrationCommand)),[] => /Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/public/protected/commands,[] => CConsoleCommandRunner Object ([commands] => Array ([migrate] => Array ([class] => application.extensions.yii-dbmigrations.CDbMigrationCommand),[message] => /Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/yii/cli/commands/MessageCommand.php,[shell] => /Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/yii/cli/commands/ShellCommand.php,[webapp] => /Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/yii/cli/commands/WebAppCommand.php),[] => ./protected/yiic,[] => ,[] => ),[name] => My Console Application,[charset] => UTF-8,[sourceLanguage] => en_us,[] => ,[] => /Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/public/protected,[] => ,[] => ,[] => ,[] => ,[] => ,[] => ,[preload] => Array (),[behaviors] => Array (),[] => ,[] => ,[] => ,[] => ,[] => ,[] => Array (),[] => Array (),[] => Array ([db] => CDbConnection Object ([connectionString] => mysql:host=localhost;dbname=nagloria;unix_socket=/tmp/mysql.sock,[username] => root,[password] => ,[schemaCachingDuration] => 0,[schemaCachingExclude] => Array (),[schemaCacheID] => cache,[autoConnect] => 1,[charset] => ,[emulatePrepare] => 1,[enableParamLogging] => ,[enableProfiling] => ,[] => Array (),[] => 1,[] => PDO Object (),[] => ,[] => CMysqlSchema Object ([] => ,[] => ,[] => Array (),[] => Array ([schema_version] => ),[] => CDbConnection Object ( *RECURSION*,[] => ,[] => Array (),[] => ,[] => ),[behaviors] => Array (),[] => 1,[] => ,[] => ),[coreMessages] => CPhpMessageSource Object ([cachingDuration] => 0,[cacheID] => cache,[basePath] => /Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/yii/messages,[] => Array (),[] => en_us,[] => Array (),[behaviors] => Array (),[] => 1,[] => ,[] => ),[errorHandler] => CErrorHandler Object ([maxSourceLines] => 25,[adminInfo] => the webmaster,[discardOutput] => 1,[errorAction] => ,[] => ,[behaviors] => Array (),[] => 1,[] => ,[] => )),[] => Array ([messages] => Array ([class] => CPhpMessageSource),[securityManager] => Array ([class] => CSecurityManager),[statePersister] => Array ([class] => CStatePersister),[urlManager] => Array ([class] => CUrlManager),[request] => Array ([class] => CHttpRequest)),[] => ,[] => ),[handled] => 1,[] => ,[] => )) called at [/Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/yii/base/CErrorHandler.php:96]
#2  CErrorHandler->handle(CErrorEvent Object ([code] => 2,[message] => PDOStatement::execute() expects parameter 1 to be array, string given,[file] => /Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/yii/db/CDbCommand.php,[line] => 352,[sender] => CConsoleApplication Object ([commandMap] => Array ([migrate] => Array ([class] => application.extensions.yii-dbmigrations.CDbMigrationCommand)),[] => /Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/public/protected/commands,[] => CConsoleCommandRunner Object ([commands] => Array ([migrate] => Array ([class] => application.extensions.yii-dbmigrations.CDbMigrationCommand),[message] => /Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/yii/cli/commands/MessageCommand.php,[shell] => /Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/yii/cli/commands/ShellCommand.php,[webapp] => /Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/yii/cli/commands/WebAppCommand.php),[] => ./protected/yiic,[] => ,[] => ),[name] => My Console Application,[charset] => UTF-8,[sourceLanguage] => en_us,[] => ,[] => /Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/public/protected,[] => ,[] => ,[] => ,[] => ,[] => ,[] => ,[preload] => Array (),[behaviors] => Array (),[] => ,[] => ,[] => ,[] => ,[] => ,[] => Array (),[] => Array (),[] => Array ([db] => CDbConnection Object ([connectionString] => mysql:host=localhost;dbname=nagloria;unix_socket=/tmp/mysql.sock,[username] => root,[password] => ,[schemaCachingDuration] => 0,[schemaCachingExclude] => Array (),[schemaCacheID] => cache,[autoConnect] => 1,[charset] => ,[emulatePrepare] => 1,[enableParamLogging] => ,[enableProfiling] => ,[] => Array (),[] => 1,[] => PDO Object (),[] => ,[] => CMysqlSchema Object ([] => ,[] => ,[] => Array (),[] => Array ([schema_version] => ),[] => CDbConnection Object ( *RECURSION*,[] => ,[] => Array (),[] => ,[] => ),[behaviors] => Array (),[] => 1,[] => ,[] => ),[coreMessages] => CPhpMessageSource Object ([cachingDuration] => 0,[cacheID] => cache,[basePath] => /Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/yii/messages,[] => Array (),[] => en_us,[] => Array (),[behaviors] => Array (),[] => 1,[] => ,[] => ),[errorHandler] => CErrorHandler Object ([maxSourceLines] => 25,[adminInfo] => the webmaster,[discardOutput] => 1,[errorAction] => ,[] => ,[behaviors] => Array (),[] => 1,[] => ,[] => )),[] => Array ([messages] => Array ([class] => CPhpMessageSource),[securityManager] => Array ([class] => CSecurityManager),[statePersister] => Array ([class] => CStatePersister),[urlManager] => Array ([class] => CUrlManager),[request] => Array ([class] => CHttpRequest)),[] => ,[] => ),[handled] => 1,[] => ,[] => )) called at [/Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/yii/base/CApplication.php:630]
#3  CApplication->handleError(2, PDOStatement::execute() expects parameter 1 to be array, string given, /Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/yii/db/CDbCommand.php, 352, Array ([this] => CDbCommand Object ([] => CDbConnection Object ([connectionString] => mysql:host=localhost;dbname=nagloria;unix_socket=/tmp/mysql.sock,[username] => root,[password] => ,[schemaCachingDuration] => 0,[schemaCachingExclude] => Array (),[schemaCacheID] => cache,[autoConnect] => 1,[charset] => ,[emulatePrepare] => 1,[enableParamLogging] => ,[enableProfiling] => ,[] => Array (),[] => 1,[] => PDO Object (),[] => ,[] => CMysqlSchema Object ([] => ,[] => ,[] => Array (),[] => Array ([schema_version] => ),[] => CDbConnection Object ( *RECURSION*,[] => ,[] => Array (),[] => ,[] => ),[behaviors] => Array (),[] => 1,[] => ,[] => ),[] => SELECT `id` FROM `schema_version` ORDER BY `id`,[] => PDOStatement Object ([queryString] => SELECT `id` FROM `schema_version` ORDER BY `id`),[] => Array (),[] => ,[] => ),[method] => fetchAll,[mode] => 7,[params] => id,[par] => ))
#4  PDOStatement->execute(id) called at [/Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/yii/db/CDbCommand.php:352]
#5  CDbCommand->queryInternal(fetchAll, 7, id) called at [/Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/yii/db/CDbCommand.php:321]
#6  CDbCommand->queryColumn(id) called at [/Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/public/protected/extensions/yii-dbmigrations/CDbMigrationEngine.php:187]
#7  CDbMigrationEngine->getAppliedMigrations() called at [/Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/public/protected/extensions/yii-dbmigrations/CDbMigrationEngine.php:295]
#8  CDbMigrationEngine->applyMigrations(create) called at [/Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/public/protected/extensions/yii-dbmigrations/CDbMigrationEngine.php:86]
#9  CDbMigrationEngine->run(Array ([0] => create,[1] => users)) called at [/Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/public/protected/extensions/yii-dbmigrations/CDbMigrationCommand.php:99]
#10 CDbMigrationCommand->run(Array ([0] => create,[1] => users)) called at [/Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/yii/console/CConsoleCommandRunner.php:62]
#11 CConsoleCommandRunner->run(Array ([0] => ./protected/yiic,[1] => migrate,[2] => create,[3] => users)) called at [/Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/yii/console/CConsoleApplication.php:88]
#12 CConsoleApplication->processRequest() called at [/Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/yii/base/CApplication.php:135]
#13 CApplication->run() called at [/Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/yii/yiic.php:31]
#14 require_once(/Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/yii/yiic.php) called at [/Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/public/protected/yiic.php:7]
#15 require_once(/Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/public/protected/yiic.php) called at [/Volumes/MAFIOUS/14bits/src/nagloria/trunk/web/public/protected/yiic:4]



I 'm calling this line on command line:

$ ./protected/yiic migrate create users 


And the configuration is that:
'commandMap' => array('migrate' => array('class' => 'application.extensions.yii-dbmigrations.CDbMigrationCommand')),

'components' => array('db' => array('class' => 'system.db.CDbConnection', 
              		      'connectionString' => 'mysql:host=localhost;dbname=nagloria;unix_socket=/tmp/mysql.sock', 
              		      'username' => 'root', 
              		      'password' => '',
              		      'emulatePrepare' => true)),
	


I did some tests with version 1.0.8 of yii and the extansion run well, but with 1.0.10 the problem happened.
Could you help me to fix up this?
Thanks.

0

#31 User is offline   GodFather 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 91
  • Joined: 19-July 09

Posted 27 October 2009 - 08:25 AM

Hi,
actualy, I needed to do a downgrade to 1.0.8 version of yii, becouse I need to finish this job asap, but I have a new project to start on few days and I intent to test the last version of yii with yii-dbmigrations.

Thanks for your help.
0

#32 User is offline   GodFather 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 91
  • Joined: 19-July 09

Posted 27 October 2009 - 08:27 AM

To clarify, the downgrade was necessary to use dbmigrations, becouse I knew that dbmigration work on this version.
Thanks.
0

#33 User is offline   Coyote 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 02-December 09

Posted 02 December 2009 - 08:52 PM

Hello!

Have the same error like GodFather:
PHP Error[2]: PDOStatement::execute() expects parameter 1 to be array, string gi
ven
in file Z:\home\vc\framework\db\CDbCommand.php at line 355
#0  CConsoleApplication->displayError(2, PDOStatement::execute() expects paramet
er 1 to be array, string given, Z:\home\vc\framework\db\CDbCommand.php, 355) cal
led at [Z:\home\vc\framework\base\CErrorHandler.php:204]
#1  CErrorHandler->handleError(CErrorEvent Object ([code] => 2,[message] => PDOS
tatement::execute() expects parameter 1 to be array, string given,[file] => Z:\h
ome\vc\framework\db\CDbCommand.php,[line] => 355,[sender] => CConsoleApplication
 Object ([commandMap] => Array ([migrate] => Array ([class] => application.exten
sions.yii-dbmigrations.CDbMigrationCommand)),[] => Z:\home\vc\preview\protected\
commands,[] => CConsoleCommandRunner Object ([commands] => Array ([migrate] => A
rray ([class] => application.extensions.yii-dbmigrations.CDbMigrationCommand),[m
essage] => Z:\home\vc\framework/cli/commands\MessageCommand.php,[shell] => Z:\ho
me\vc\framework/cli/commands\ShellCommand.php,[webapp] => Z:\home\vc\framework/c
li/commands\WebAppCommand.php),[] => Z:\home\vc\preview\protected\yiic.php,[] =>
 ,[] => ),[name] => My Console Application,[charset] => UTF-8,[sourceLanguage] =
> en_us,[] => ,[] => Z:\home\vc\preview\protected,[] => ,[] => ,[] => ,[] => ,[]
 => ,[] => ,[preload] => Array (),[behaviors] => Array (),[] => ,[] => ,[] => ,[
] => ,[] => ,[] => Array (),[] => Array (),[] => Array ([db] => CDbConnection Ob
ject ([connectionString] => mysql:host=localhost;dbname=vampirecastle,[username]
 => root,[password] => ,[schemaCachingDuration] => 0,[schemaCachingExclude] => A
rray (),[schemaCacheID] => cache,[autoConnect] => 1,[charset] => ,[emulatePrepar
e] => ,[enableParamLogging] => ,[enableProfiling] => ,[tablePrefix] => ,[] => Ar
ray (),[] => 1,[] => PDO Object (),[] => ,[] => CMysqlSchema Object ([] => ,[] =
> ,[] => Array (),[] => Array ([schema_version] => CMysqlTableSchema Object ([sc
hemaName] => ,[name] => schema_version,[rawName] => `schema_version`,[primaryKey
] => ,[sequenceName] => ,[foreignKeys] => Array (),[columns] => Array ([id] => C
MysqlColumnSchema Object ([name] => id,[rawName] => `id`,[allowNull] => 1,[dbTyp
e] => varchar(255),[type] => string,[defaultValue] => ,[size] => 255,[precision]
 => 255,[scale] => ,[isPrimaryKey] => ,[isForeignKey] => ,[] => ,[] => )),[] =>
,[] => )),[] => CDbConnection Object ( *RECURSION*,[] => ,[] => Array (),[] => ,
[] => ),[behaviors] => Array (),[] => 1,[] => ,[] => ),[errorHandler] => CErrorH
andler Object ([maxSourceLines] => 25,[adminInfo] => the webmaster,[discardOutpu
t] => 1,[errorAction] => ,[] => ,[behaviors] => Array (),[] => 1,[] => ,[] => ))
,[] => Array ([coreMessages] => Array ([class] => CPhpMessageSource,[language] =
> en_us,[basePath] => Z:\home\vc\framework\messages),[messages] => Array ([class
] => CPhpMessageSource),[securityManager] => Array ([class] => CSecurityManager)
,[statePersister] => Array ([class] => CStatePersister),[urlManager] => Array ([
class] => CUrlManager),[request] => Array ([class] => CHttpRequest)),[] => ,[] =
> ),[handled] => 1,[] => ,[] => )) called at [Z:\home\vc\framework\base\CErrorHa
ndler.php:96]

....
#4  PDOStatement->execute(id) called at [Z:\home\vc\framework\db\CDbCommand.php:
355]
#5  CDbCommand->queryInternal(fetchAll, 7, id) called at [Z:\home\vc\framework\d
b\CDbCommand.php:324]
#6  CDbCommand->queryColumn(id) called at [Z:\home\vc\preview\protected\extensio
ns\yii-dbmigrations\CDbMigrationEngine.php:162]
#7  CDbMigrationEngine->getAppliedMigrations() called at [Z:\home\vc\preview\pro
tected\extensions\yii-dbmigrations\CDbMigrationEngine.php:277]
#8  CDbMigrationEngine->applyMigrations(create) called at [Z:\home\vc\preview\pr
otected\extensions\yii-dbmigrations\CDbMigrationEngine.php:73]
#9  CDbMigrationEngine->run(Array ([0] => create,[1] => UserMigration)) called a
t [Z:\home\vc\preview\protected\extensions\yii-dbmigrations\CDbMigrationCommand.
php:39]
#10 CDbMigrationCommand->run(Array ([0] => create,[1] => UserMigration)) called
at [Z:\home\vc\framework\console\CConsoleCommandRunner.php:62]
#11 CConsoleCommandRunner->run(Array ([0] => Z:\home\vc\preview\protected\yiic.p
hp,[1] => migrate,[2] => create,[3] => UserMigration)) called at [Z:\home\vc\fra
mework\console\CConsoleApplication.php:88]
#12 CConsoleApplication->processRequest() called at [Z:\home\vc\framework\base\C
Application.php:135]
#13 CApplication->run() called at [Z:\home\vc\framework\yiic.php:31]
#14 require_once(Z:\home\vc\framework\yiic.php) called at [Z:\home\vc\preview\pr
otected\yiic.php:7]


I tried to use Yii 1.1beta is there any chance to continue without downgrading?
Please, specify the last supported version

Thank you!
0

#34 User is offline   Coyote 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 02-December 09

Posted 02 December 2009 - 09:01 PM

Oh! I've just downloaded version from
http://www.yiiframew...i-dbmigrations/
not GitHub and it perfectly works!

Thank you for such a great extension!
0

#35 User is offline   r.vas 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 12
  • Joined: 22-December 09

Posted 29 December 2009 - 12:22 PM

DB connection works well for application.

but yii-dbmigrations (current git version) has a problem @ my install:

Quote

protected\yiic migrate create
Migrations directory: protected/migrations/

ERROR: Database configuration is missing in your configuration file.


why app config is not acceptable by dbmigrations?
Dev: Win+Wamp (php_5.3.0, mysql_5.1.36, apache_2.2.11)
Prod: Debian (php_5.3.1, mysql_5.1.41, nginx)
---and i'm a total noob
0

#36 User is offline   GodFather 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 91
  • Joined: 19-July 09

Posted 19 February 2010 - 06:38 AM

View Postr.vas, on 29 December 2009 - 12:22 PM, said:

DB connection works well for application.

but yii-dbmigrations (current git version) has a problem @ my install:



why app config is not acceptable by dbmigrations?


Hi,
I had the same problem and fix putting this on connection string
unix_socket=/tmp/mysql.sock
0

#37 User is offline   GodFather 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 91
  • Joined: 19-July 09

Posted 19 February 2010 - 07:08 AM

Hi,
I'm using the lastest version of yii-dbmigrations, and I saw that the form of create tables changed (from arrays to objects), and I can't declare a field like int(11), so I'd like know:

How can I pass my own arguments to table fields?

Thanks
0

#38 User is offline   imehesz 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 708
  • Joined: 13-June 09
  • Location:Jacksonville, FL

Posted 21 September 2010 - 03:44 PM

Hello,

I have the exact same problem, but I'm using SQLite (so the socket thing wouldn't work)

thx,
--iM
It’s done, the great act of creation.
The maker rests. The wheel’s in motion.
-- Imre Madách

check out Yii Theme Factory at http://yii.themefactory.net
0

#39 User is offline   imehesz 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 708
  • Joined: 13-June 09
  • Location:Jacksonville, FL

Posted 21 September 2010 - 08:26 PM

never mind, I should learn to read the documentation first ... ()forgot to setup the connection to the DB itself),

so it works so far :)

thx,
--iM
It’s done, the great act of creation.
The maker rests. The wheel’s in motion.
-- Imre Madách

check out Yii Theme Factory at http://yii.themefactory.net
0

#40 User is offline   GodFather 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 91
  • Joined: 19-July 09

Posted 30 January 2011 - 05:12 PM

Hi folks,
I have a new problem using the latest version of yii-dbmigration, when I run the migration the console shows the message below and the migration not work

$ ./protected/yiic migrate
Migrations directory: protected/migrations/

=== Applying: m20110123200901_create_eav_table =================================
ERROR: m20110123200901_create_eav_table does not have a method named "performTransactional".




The code of migration is:
<?php

class m20110123200901_create_eav_table extends CDbMigration {
    
    public function up() {
      $t = $this->newTable('eav');
      $t->primary_key('id');
      $t->integer('section_id');
      $t->integer('entry_id');
      $t->integer('field_id');
      $t->string('attribute');
      $t->text('value');
      $t->datetime('created_at');
      $t->datetime('updated_at');
      $this->addTable($t);
    }
    
    public function down() {
      $this->removeTable('eav');
    }
    
}


Anyone know what happens?

Thanks.
0

Share this topic:


  • (3 Pages)
  • +
  • 1
  • 2
  • 3
  • 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