I have a custom module with my_module.install file defining my two data tables in mysql. Module is already installed and I am able to save data from forms into them. Now my requirements changed and I need to create a third table in the same module. How do I approach the reinstall of the module.
1) Prepare MYSQl scripts to backup the existing data into temp tables and after uninstall and reinstalling the module, copy back the data into tables from temp tables.
2) Looked into https://www.drupal.org/project/backup_migrate not compatible to drupal core version I am using 8.6.0
3) Any other modules or ideas?
edited after the suggestion: I have created the below function in mymodule.install file and also edited mymodule_schema() method and run drush updatedb. Still no db changes as expected table is not getting created. Not able to look into system table to get the recent version number as mentioned elsewhere because that table is not available in my current local DB.
function mymodule_update_8601(){
$spec = array(
'fields' => array(
'application_setup_id' => array(
'type' => 'serial',
'not null' => TRUE,
'description' => 'Primary Key: ID',
),
),
);
$schema = Database::getConnection()->schema();
$schema->createTable('application_setup', $spec);
}