Copying database records from one table to another

3 posts by 2 authors in: Forums > CMS Builder
Last Post: October 28, 2015   (RSS)

By Dave - October 28, 2015

Hi Terry, 

There's no built in support for that.  

But to not generate the :label, etc fields you can add this option to getRecords:

'loadPseudoFields' => false, 
'loadCreatedBy'    => false, // also add this to not export createdBy.* fields
'loadUploads'      => false, // and to not output upload data (which won't get copied anyways)

 And here's a way to copy an entire table: 

  • Go to: Admin > General > Backup & Restore
  • Backup your entire database for safety (select: All Database Table)
  • Now, backup the table you want to copy, eg: example1
  • Find the backup file, eg: cmsb/data/backups/hostname-v2.##-20151022-145723-example1.sql.php
  • Rename it from "example1" to "example2"
  • Open the file and replace #TABLE_PREFIX#_example1 to #TABLE_PREFIX#_example2
  • Restore the renamed backup file under: Admin > General

Hope that helps!  Good luck!

Dave Edis - Senior Developer
interactivetools.com

Hi Dave,

I like the second option much better and it worked absolutely perfectly!

Thanks very much.

Best regards

Terry