SA-MP Forums Archive
MySQL structure lost. Rebuilding it automatically ? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: MySQL structure lost. Rebuilding it automatically ? (/showthread.php?tid=599338)



MySQL structure lost. Rebuilding it automatically ? - FSAOskar - 24.01.2016

Hey,
I recently had some problems with my hoster and I ended up loosing database structure. So of course I could go through my whole script and search for all the tables and fields which need to be created but that would need forever. Is there any way in MySQL to create a table with it's field automatically if they don't exist without using CREATE TABLE ?
For example: I'm using a query which should insert stuff into a field. Field and table aren't existing. Now as they aren't existing they should be created and my stuff should be inserted.

Thanks in advance.


Re: MySQL structure lost. Rebuilding it automatically ? - Vince - 24.01.2016

Sadly, no. Unfortunately had that happen myself when I tried to open a virtual machine after reinstalling Windows. The virtual drive somehow got corrupted and the database structure (three tables at the time only, luckily) got lost. Lesson learned: make backups regularly.


Re: MySQL structure lost. Rebuilding it automatically ? - FSAOskar - 24.01.2016

Well, the thing is I saved the backups on the VPS which got reset due to a server upgrade. The last backup I've saved locally on my PC is from months ago.
I thought about letting the server read the mysql.log line per line and if there's a missing table/field error I could format a CREATE TABLE query with the required table name from the log file.