Custom Module - Database Error when inserting data

We have created a custom module on suitecrm and when trying to insert data into it.it is getting a database error.

Log.

Thu Jun 9 05:01:11 2022 [14332][1][FATAL] Mysqli_query failed.
Thu Jun 9 05:01:11 2022 [14332][1][FATAL] Error inserting into table: gv022_gravity_form: Query Failed: INSERT INTO gv022_gravity_form (id,name,date_entered,date_modified,modified_user_id,created_by,description,deleted,assigned_user_id)
VALUES (‘218717cb-0e04-9832-daa5-62a17e1d7471’,‘Test’,‘2022-06-09 05:01:11’,‘2022-06-09 05:01:11’,‘1’,‘1’,‘TeT’,0,‘1’): MySQL error 1146: Table ‘crm.gv022_gravity_form’ doesn’t exist
Thu Jun 9 05:01:11 2022 [14332][1][FATAL] Exception handling in /var/www/crm.quikbox.com/html/include/MVC/Controller/SugarController.php:400
Thu Jun 9 05:01:11 2022 [14332][1][FATAL] Exception in Controller: Database failure. Please refer to suitecrm.log for details.
Thu Jun 9 05:01:11 2022 [14332][1][FATAL] backtrace:
#0 /var/www/crm.quikbox.com/html/include/database/DBManager.php(353): sugar_die(‘Database failur…’)
#1 /var/www/crm.quikbox.com/html/include/database/DBManager.php(328): DBManager->registerError(‘Error inserting…’, ‘Error inserting…’, true)
#2 /var/www/crm.quikbox.com/html/include/database/MysqliManager.php(179): DBManager->checkError(‘Error inserting…’, true)
#3 /var/www/crm.quikbox.com/html/include/database/DBManager.php(519): MysqliManager->query(‘INSERT INTO gv0…’, true, ‘Error inserting…’)
#4 /var/www/crm.quikbox.com/html/data/SugarBean.php(2412): DBManager->insert(Object(gv022_Gravity_Form))
#5 /var/www/crm.quikbox.com/html/include/MVC/Controller/SugarController.php(684): SugarBean->save(false)
#6 /var/www/crm.quikbox.com/html/include/MVC/Controller/SugarController.php(525): SugarController->action_save()
#7 /var/www/crm.quikbox.com/html/include/MVC/Controller/SugarController.php(494): SugarController->do_action()
#8 /var/www/crm.quikbox.com/html/include/MVC/Controller/SugarController.php(468): SugarController->handle_action()
#9 /var/www/crm.quikbox.com/html/include/MVC/Controller/SugarController.php(373): SugarController->process()
#10 /var/www/crm.quikbox.com/html/include/MVC/SugarApplication.php(113): SugarController->execute()
#11 /var/www/crm.quikbox.com/html/index.php(52): SugarApplication->execute()
#12 {main}

To resolve this, first, you should verify if the gv022_gravity_form table exists in the database. You can do this by running a query using a MySQL client or phpMyAdmin. If the table is missing, this could suggest that it wasn’t created during the custom module setup.

A useful step would be to use SuiteCRM’s “Repair and Rebuild” function. This feature can sometimes resolve issues related to missing tables or database inconsistencies. By navigating to the Admin section and selecting “Quick Repair and Rebuild,” crm data enrichment may prompt you to execute certain SQL commands to synchronize the database schema with the custom module files. Allow it to run these commands if you are prompted.