0

Drop Magento Database in One Query

The code below does as the title suggests. If anyone has been trying to remove the Magento database for whatever reason you’ll find that with all of the key constraints that come with Magento droping every table at once requires a special bit of code.

Below is from a 1.7.0.2 store, different version of Magento may have slightly different tables and custom modules for Magento will also sometimes add their own tables. But in general the code below should work for most and with one execution drop every table in the db.

The most important code in the snippet above is the:

and

These snippets of code disable the key checks and allow the query to execute as intended.

Unknown source

 

Leave a reply