Magento: Upgrading mysql setup of a module

Suppose, you have a module called MyModule. Its version is 0.1.0. Now, you want to do some database changes for the module. You have the mysql setup file (mysql install file) mysql4-install-0.1.0.php in MyModule/sql/mymodule_setup folder of your module. You don’t need to make direct changes to database. You can upgrade your module to make your … Read more

Magento: Describing Flat Catalog

Difference between EAV and Flat Catalog In EAV database model, data are stored in different smaller tables rather than storing in a single table. Like, product name is stored in catalog_product_entity_varchar table product id is stored in catalog_product_entity_int table product price is stored in catalog_product_entity_decimal table EAV database model is used by Magento for easy … Read more

Using database in PEAR and Smarty

For using database, you need to install a package of PEAR called ‘MDB2’ along with the installation of PEAR and Smarty. MDB2 provides a common API for all support RDBMS. Connecting to database To instantiate a database object you have several methods available using MDB2. factory(): Will instantiate a new MDB2_Driver_Common instance, but will not … Read more

MySQL: Backup/Export and Restore/Import Database & Table

This article shows how to backup/export and restore/import single & multiple databases and tables in MySQL. Backup/Export 1) Backup/Export single database mysqldump -h hostname -u username -p database_name > /path/backup.sql 2) Backup/Export multiple databases mysqldump -h hostname -u username -p –databases db1 db2 db3 > /path/threedb.sql Here: db1, db2, db3 are three different database name. … Read more