nam797 — 2012-04-14T10:17:37-04:00 — #1
I need to automate signup for my Saas application. The part i am at now is using php to copy a database and rename it for the new company signing up.
Has anyone had the experience of doing this all ready?
database naming is data_companyname
Thanks for all the help
spacephoenix — 2012-04-14T10:57:39-04:00 — #2
You could (after having created the new (copy) database:
- generate a SHOW CREATE TABLE query for each table in the database to be copied
- Run the output of the SHOW CREATE TABLE queries against the new database.
- Use SELECT INSERT queries to copy the data across for each table (you might want to block entry or editing of any data from the origin database whilst copying the data across to be 100% sure that you're copying it all across).