ruckus / ruckusing-migrations

Database migrations for PHP ala ActiveRecord Migrations with support for MySQL, Postgres, SQLite
Other
506 stars 95 forks source link

Is it possible to execute the ruckusing-migration through http request #160

Open Gampesh opened 9 years ago

Gampesh commented 9 years ago

Is it possible to execute the migration command through http request? Actually i wanted to create some services which will update the database based on the parameter i.e. task, ENV.

kevcam4891 commented 9 years ago

Its definitely possible, but as for implementation, it depends on your framework. CakePHP and other frameworks make it VERY easy to do this. Just map a url to a specific controller/action.

If you do not use a framework, you will have to map a URL request to your apache installation which should fire a php script.

However apache ultimately reaches and executes the PHP, that script should contain code that exec()'s the migration update command.

Gampesh mailto:notifications@github.com July 1, 2015 at 8:43 AM

Is it possible to execute the migration command through http request? Actually i wanted to create some services which will update the database based on the parameter i.e. task, ENV.

— Reply to this email directly or view it on GitHub https://github.com/ruckus/ruckusing-migrations/issues/160.

Gampesh commented 9 years ago

Thanks for the reply. I am new to this and I am not sure how to map url. Also Ruckusing_FrameworkRunner method require $argv which is a global variable. So when I would do HTTP request $argv does not contain the values of post or get request. I am trying to use it in Zend Framework 1. any help would be appreciated.

silverslice commented 9 years ago

As mentioned in https://github.com/ruckus/ruckusing-migrations/issues/134

Currently the CLI is the primary interface. But it should be straight-forward enough to write your own web wrapper around the tool.

You can manually build arguments in your script and then run ruckus with exec() function in php something like this:

exec('./bin/ruckus.php db:migrate', $output);
echo implode('<br>', $output);
Gampesh commented 9 years ago

Thanks let me try this.