Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cakephp 3 unable to migrate mongo db #9

Closed
response2nik opened this issue Jan 2, 2017 · 3 comments
Closed

cakephp 3 unable to migrate mongo db #9

response2nik opened this issue Jan 2, 2017 · 3 comments

Comments

@response2nik
Copy link

plz help on this,

Exception: Could not infer database type from driver in [/var/www/nikhil3/vendor/cakephp/migrations/src/ConfigurationTrait.php, line 151]
2016-12-26 05:15:33 Error: [InvalidArgumentException] Could not infer database type from driver
Stack Trace:
#0 /var/www/nikhil3/vendor/cakephp/migrations/src/ConfigurationTrait.php(83): Migrations\Command\Migrate->getAdapterName('Hayko\Mongodb\D...')
#1 /var/www/nikhil3/vendor/robmorgan/phinx/src/Phinx/Console/Command/AbstractCommand.php(91): Migrations\Command\Migrate->getConfig()
#2 /var/www/nikhil3/vendor/cakephp/migrations/src/ConfigurationTrait.php(206): Phinx\Console\Command\AbstractCommand->bootstrap(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /var/www/nikhil3/vendor/robmorgan/phinx/src/Phinx/Console/Command/Migrate.php(72): Migrations\Command\Migrate->bootstrap(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 /var/www/nikhil3/vendor/cakephp/migrations/src/ConfigurationTrait.php(165): Phinx\Console\Command\Migrate->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 /var/www/nikhil3/vendor/cakephp/migrations/src/Command/Migrate.php(58): Migrations\Command\Migrate->parentExecute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 /var/www/nikhil3/vendor/symfony/console/Command/Command.php(255): Migrations\Command\Migrate->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /var/www/nikhil3/vendor/symfony/console/Application.php(830): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /var/www/nikhil3/vendor/symfony/console/Application.php(191): Symfony\Component\Console\Application->doRunCommand(Object(Migrations\Command\Migrate), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 /var/www/nikhil3/vendor/symfony/console/Application.php(122): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /var/www/nikhil3/vendor/cakephp/migrations/src/Shell/MigrationsShell.php(98): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput))
#11 [internal function]: Migrations\Shell\MigrationsShell->main('migrations', 'migrate')
#12 /var/www/nikhil3/vendor/cakephp/cakephp/src/Console/Shell.php(466): call_user_func_array(Array, Array)
#13 /var/www/nikhil3/vendor/cakephp/migrations/src/Shell/MigrationsShell.php(130): Cake\Console\Shell->runCommand(Array, true, Array)
#14 /var/www/nikhil3/vendor/cakephp/cakephp/src/Console/ShellDispatcher.php(227): Migrations\Shell\MigrationsShell->runCommand(Array, true, Array)
#15 /var/www/nikhil3/vendor/cakephp/cakephp/src/Console/ShellDispatcher.php(182): Cake\Console\ShellDispatcher->_dispatch(Array)
#16 /var/www/nikhil3/vendor/cakephp/cakephp/src/Console/ShellDispatcher.php(128): Cake\Console\ShellDispatcher->dispatch(Array)
#17 /var/www/nikhil3/bin/cake.php(34): Cake\Console\ShellDispatcher::run(Array)
#18 {main}

thanks in advance.

@tiaguinho
Copy link
Owner

I don't think migrations is useful for mongodb since the collections is created on the fly.
Can you post some code for me to understand better what are you doing?

thank you

@response2nik
Copy link
Author

response2nik commented Jan 9, 2017

Hi,
sorry for late reply, I am only running the migration command given below to migrate with mongo
bin/cake migrations migrate -p CakeDC/Users

Thanks

@tiaguinho
Copy link
Owner

But mongo is schemaless.
You don't need to use migrations with mongo, just modify your entity and the database will save the new object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants