CodeIgniter Forums
Migration w/Multiple Table Prefixes - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Migration w/Multiple Table Prefixes (/showthread.php?tid=80236)



Migration w/Multiple Table Prefixes - jsurp2001 - 10-04-2021

I have searched through the documentation and have not been successful in finding the answer but, is there any way to apply a migration to several tables with different prefixes at once?:
client1_sessions
client1_users
client1_profile
client2_sessions
client2_users
client2_profile

Any help would be appreciated. Thanks in advance!


RE: Migration w/Multiple Table Prefixes - includebeer - 10-04-2021

A migration is just a PHP class. You can loop through all your prefixes, build the table name with the right prefix and call the Forge function with that.