Help to resolve the module table in DB

I met with some problems while upgrading omekas. (i did some mistakes because i am not good at DB managment). Now after reinstalling fresh version of omekas4.0.4, i couldn’t install required modules. For instance, while i try to install EasyAdmin, it said that the table module need to be removed, because it already had some records in it.

Immediate problem:

I dropped the module table from db. This resulted in omkeas in dysfunctional state. So i went back and created a table in the same name (module). With this i got back the omekas and all of the records.
However, the modules are not installing as expected.

So i tried connecting with some DB viewer.

ER diagram shows module table without any relation. Which is obvious, but just to make sure that i have not done any more damage.

similarly i also need to recreate the table like api_key.

please review and help me solve the module table problem. Is there any way to create the module table with proper configuration. ? It is a DB/SQL problem i hope, and if so, i can follow up the instructions to resolve this awful situation.

In general with your database issue, the very best option might be if you have logical backups (i.e., a dump of the database) that you could revert to, or a backup of the underlying database files.

But, if you have to proceed from where you are now: your problem is probably that the modules were already installed, but by recreating the modules table, they’re all effectively marked as uninstalled.

You could try the route of removing the tables created by the modules, so they could be re-installed (but this will lose whatever data is associated with those modules, similar to uninstalling them). Otherwise, you could try to restore the contents of the module table which marked the modules as installed. If you know the module names and versions you previously had installed, you could try to create a row in the module table for each.

1 Like

@jflatnes thanks for helping me here.
I tried to follow the instructions from MariaDB documentation on how to restore specific tables in a dB from existing backup dump. Succeeded fairly in it.

Now i have those dropped tables back into the dB.

Above shown tables : api_key, module are the ones that have created problem (because of my dumb anxious mistake). Now after restoring they are functional. Particularly when i tried to install EasyAdmin module, omekas reported problems in the corresponding table. So i tried to insert a data row for EasyAdmin and then the module started working as expected.

Your replies gave some confidence in what i am doing as an organizer to a level where dB needs to be handled. Thanks a lot.