I need to clone current database, and assign it a new name. How to do this from within rails app?. Or maybe I need to run some bash mysqldump -h [server] -u [user] -p[password] db1 | mysql -h [server] -u [user] -p[password] db2 ? if so, how to implement it (run from rails model)?.
Thanks for help.
Add a comment
|
1 Answer
There is not direct method to do this in Rails. MySQL mysqldump utility works best in these cases.
5 Comments
Andrey Yasinishyn
blame.. I hoped that this magic exists )). So the issue now is - how to run this command from within rails model (I need it to be a model:) ).
Andrey Yasinishyn
can I user
exec('ls ~') ??techvineet
Why you want to make it in models? Will you run it too often?
Andrey Yasinishyn
Once a year, but I want to store all the logic in one model. It will be peaty hairy.
Andrey Yasinishyn
Ok, I find an solution here Execute shell commands