Hi,
I migrated a suite crm database to a new server. The database included custom modules created using Module Builder and custom fields created in Studio (so has tables and _cstm tables). I created the modules again in Module Builder and deployed them and that was fine. The problem I have is that although the custom fields exist in the DB, I cannot recreate them in Studio as I get an error. Is there any way of rebuilding the link between the db fields and SuiteCRM? If not, what directories/files do I need to copy from the old build to the new one?
I didn’t copy the old structure the new server as the old one was a bitnami build and was slightly different so I though it would be best to build SuiteCRM from scrath on the new server.
Below is the error in suitecrm.log:
Tue May 12 13:26:56 2020 [1167][47a9baa7-29d1-9739-f972-5ceeb40e66e2][FATAL] Mysqli_query failed.
Tue May 12 13:26:56 2020 [1167][47a9baa7-29d1-9739-f972-5ceeb40e66e2][FATAL] Cannot create column Query Failed: ALTER TABLE bm_payrolls_cstm add COLUMN payroll_base_charge_c decimal(26,6) NULL : MySQL error 1060: Duplicate column name 'payroll_base_charge_c'
Tue May 12 13:26:56 2020 [1167][47a9baa7-29d1-9739-f972-5ceeb40e66e2][FATAL] Exception handling in /var/www/html/suitecrm/include/MVC/Controller/SugarController.php:400
Tue May 12 13:26:56 2020 [1167][47a9baa7-29d1-9739-f972-5ceeb40e66e2][FATAL] Exception in Controller: Database failure. Please refer to suitecrm.log for details.
Thanks
You mean you don’t need any data that are in custom fields?
then you can delete the table _cstm of the module that you don’t need and do repair & rebuild then recreate it.
Thanks for your reply.
I renamed the _cstm table and then a repair and still the same problem. I tried creating a test field and this worked and then tried another field (that existed in the previous _cstm table) and had the following error in suitecrm.log:
Tue May 12 14:30:36 2020 [233508][47a9baa7-29d1-9739-f972-5ceeb40e66e2][FATAL] Mysqli_query failed.
Tue May 12 14:30:36 2020 [233508][47a9baa7-29d1-9739-f972-5ceeb40e66e2][FATAL] Error inserting into table: fields_meta_data: Query Failed: INSERT INTO fields_meta_data (id,name,vname,comments,help,custom_module,type,len,required,default_value,date_modified,deleted,audited,massupdate,duplicate_merge,reportable,importable,ext1,ext2,ext3,ext4)
VALUES ('bm_payrollspayroll_employee_charge_c','payroll_employee_charge_c','LBL_PAYROLL_EMPLOYEE_CHARGE','','','bm_payrolls','currency',26,0,'','2020-05-12 13:30:36',0,0,0,0,1,'true','','','',''): MySQL error 1062: Duplicate entry 'bm_payrollspayroll_employee_charge_c' for key 'PRIMARY'
Tue May 12 14:30:36 2020 [233508][47a9baa7-29d1-9739-f972-5ceeb40e66e2][FATAL] Exception handling in /var/www/html/suitecrm/include/MVC/Controller/SugarController.php:400
Tue May 12 14:30:36 2020 [233508][47a9baa7-29d1-9739-f972-5ceeb40e66e2][FATAL] Exception in Controller: Database failure. Please refer to suitecrm.log for details.
Tue May 12 14:30:36 2020 [233508][47a9baa7-29d1-9739-f972-5ceeb40e66e2][FATAL] backtrace:
#0 /var/www/html/suitecrm/include/database/DBManager.php(353): sugar_die('Database failur...')
#1 /var/www/html/suitecrm/include/database/DBManager.php(328): DBManager->registerError('Error inserting...', 'Error inserting...', true)
#2 /var/www/html/suitecrm/include/database/MysqliManager.php(179): DBManager->checkError('Error inserting...', true)
#3 /var/www/html/suitecrm/include/database/DBManager.php(519): MysqliManager->query('INSERT INTO fie...', true, 'Error inserting...')
#4 /var/www/html/suitecrm/data/SugarBean.php(2411): DBManager->insert(Object(FieldsMetaData))
Ok, rename the table fields_meta_data then do quick repair & rebuild and try.
Thank you very much - it all worked.
Can you please mark as resolved?
Can’t see where I do that - just change subject?
That’s fine, I think admin has marked it resolved