Magento 2: Create/Alter Database Table & Insert Data while Installing/Upgrading Module

This article shows how you can create a new database table and install data into the table while installing a custom module or upgrading the module in Magento 2. The install and upgrade setup script file should be inside the Setup folder of your module. The install script should be named InstallSchema.php & InstallData.php and … Read more

MongoDB: Basic Select, Insert, Update, Delete – CRUD [Beginner Tutorial]

MongoDB is an open-source document database. Document in MongoDB means a row or record in the database. A document contains data in key-value pairs. MongoDB is popular for it’s high performance, scalability and availability. This article shows how to perform simple select, insert, update, delete database operations in MongoDB. That’s also referred as CRUD (Create, … Read more

Alter MySQL table to add & drop column & add Foreign Key

This article shows:- – How to add column to mysql database table after the table has already been created – How to delete column from mysql database table after the table has already been created – How to add foreign key to table column after the table has already been created Basically, all this can … Read more

Magento: Join, filter, select and sort attributes, fields and tables

In my previous article (Magento: Very Useful Collection Functions), I had written about database interaction functions present in class Varien_Data_Collection_Db. Here, I am going to explain some database interaction functions present in the class Mage_Eav_Model_Entity_Collection_Abstract. These collection functions are very useful to select data from Magento database. We need them almost all the time for … Read more

Magento Error – Notice: Undefined index: 0 app/code/core/Mage/Core/Model/Mysql4/Config.php on line 92

I got this error message when migrating my Magento files and database from one server to another. Notice: Undefined index: 0 in app/code/core/Mage/Core/Model/Mysql4/Config.php on line 92 Solution: – Open PhpMyAdmin – Go to your database – Click SQL – Run the following SQL Query: SET FOREIGN_KEY_CHECKS=0; UPDATE `core_store` SET store_id = 0 WHERE code='admin'; UPDATE … Read more