Expose schema support for the mp_version table in the mp executable
Hi. I just started using mp.
I created migration file D:\Dropbox\MyDropbox\www\lifetest>php c:\xampplite\php\mp -x "mysql:host=localho st;port=3306;dbname=lifetest;user=lifetest;password=zaqxsw" -n MP - The PHP Migrator. Created migration 20110124_153500 at ./migrations/20110124_153500.php.
After that I wrote migration up and down sql code
And finally I want to migrate to HEAD version D:\Dropbox\MyDropbox\www\lifetest>php c:\xampplite\php\mp -x "mysql:host=localho st;port=3306;dbname=lifetest;user=lifetest;password=zaqxsw" -m MP - The PHP Migrator. Error running migration: Error initializing DB at [create table public.mp_versio n ( version text ); insert into public.mp_version (version) values (0);]: SQ LSTATE[42000]: Syntax error or access violation: 1142 CREATE command denied to u ser 'lifetest'@'localhost' for table 'mp_version'
Hi-
Actually the underlying engine has support for specifying the schema to use; see:
MigratorVersionProviderDB::OPT_SCHEMA
However I didn't expose that in the mp executable yet, I suppose since I didn't need it.
Feel free to fork the repo and add support to the "mp" script to allow an option to pass in the schema (or can that be done via the DSN?). In any case if you get that working I will be happy to merge it into the main repo.
Thanks! Alan
Thanks for answer.
Usually I deploy different projects on the same database but in different database schemes.
I think that table mp_version should be placed at the same schema that it describes.
Like schema_migrations table in Ruby on Rails framework.
I play more with mp and try to add this feature. Dmitry
I think that's a fine idea.
I usually deploy each project in its own database which is why this has never been an issue for me.