Cloning Custom Setup & Emptying Database Tables

I want to clone an existing SuiteCRM install for one company to be used with a new separate company. I want to of course duplicate workflows, custom fields, etc. I’m guessing I need to copy all the files (excluding or clearing the ‘document’ folder, log files, and what else?) And then go through table by table and determine which tables I can empty and which tables (like user table) I need to remove records individually (so I can retain the admin login)

Any suggestions on a plan of attack would be greatly appreciated as I figure SOMEONE has to have gone down this path before? Seems it will probably be impossible to remove all unnecessary traces of files/data from the previous company’s installation but other methods (starting from scratch and importing customizations) would be more of a nightmare.

Here is the exact process you need to clone an instance without cloning data or relevant files.

  1. Copy SuiteCRM folder except upload folder.
  2. Copy database without any data ie only structure of old database.
  3. from old database copy data from these tables: users, fields_metadata, config,
  4. all tables data which stars from AOW,like aow_workflow, etc.

If you want to keep only admin user in new database , run this SQL query

update users set deleted =1 where id !='1'

Hi ashish,

I followed your steps and cloned my SuiteCRM instance to another directory.
Further I updated the new db/dir name to link to the new db, modifiying the .htaccess, config.php, config_overrride.php and updated the db user_name, name&password as per new db in the config.php file.

As per your instruction I copied also the data of the users table.
The point is that I can log in with the “old” db admin credentials, but I get the SuiteCRM initial page asking me for the administrator data (name, email, etc…) and other preferences (currency, date format, etc…) which should be already in the db as I copied the users data.

What is missing?

Thanks
Mario

Hi Community,

Does anybody have a solution on this or may suggest a different approach to get the same result?

Thanks,
Mario

Hi Mario, please copy from your old instance to the new one, also:
user_preferences table
with a query like:

SELECT user_preferences.*
FROM users u
JOIN user_preferences
ON u.id = up.assigned_user_id
WHERE u.deleted <> 1 AND u.is_admin = 1

Hi LionS,

Thanks so much for your suggestion.

You know I am not so skilled as you, so are days I am wondering before asking on how I apply your instructions.
I mean within phpmyadmin I should:

  • click the old_db name
  • click the sql tab
  • copy, paste and execute your query

Is that correct? Maybe it’s me, but how the query instruct to copy the table data to the newdb?

In any case let me say that as part of the previous instructions (3. from old database copy data from these tables: users, fields_metadata, config,) I already copied user and user_preferences in the newdb.
Do I need to copy it again with your query?

Thanks again for your help,
Mario

Hi Mario, are you using PHPMyAdmin?

after these:

  • click the old_db name
  • click the sql tab
  • copy, paste and execute your query

you have to export your data


and click “execute” or “Esegui”
be careful that in the sql file you’re going to download, there will also be the CREATE TABLE commands that aren’t usesul for you; you should delete these lines before importing your data into the new DB as the user_preferences table already exitsts

Hi LionS,

Thanks for your clear explanation.

I used your query (just modified “up.assigned_user_id” in “assigned_user_id” otherwise get a “#1054” error)
and it worked. Then exported and cancelled the “CREATE TABLE” command from the .sql file.
Is the “ALTER TABLE” command at the end of the file ok to stay?

Now I am ready to import the file into the new_db, but I do not get if it is really necessary, since
as written previously, I copied this table the first time I duplicated the db.

Thanks
Davide

Great!
Please remove also the ALTER TABLE part.
Keep only the INSERT lines