0

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.

1 Answer 1

1

There is not direct method to do this in Rails. MySQL mysqldump utility works best in these cases.

Sign up to request clarification or add additional context in comments.

5 Comments

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:) ).
can I user exec('ls ~') ??
Why you want to make it in models? Will you run it too often?
Once a year, but I want to store all the logic in one model. It will be peaty hairy.
Ok, I find an solution here Execute shell commands

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.