Search code examples
mysqlopencartvqmod

How to create new database table (if not exist) through VQMOD


I want to make an operation in my vqmod that if store_manager table exist, don't do anything. Otherwise create table. How can I achieve it?


Solution

  • If you creating module, so put the code to install method of module, that will run if user click Install in admin panel near your module name.

    If it will not module, so in the first call of modEl method, where you can check is table exists or not and then create table using SQL like this:

    CREATE TABLE store_manager (id INT NOT NULL);