Skip to main content

Posts

Showing posts from November, 2022

What is Declarative Schema in Magento?

Declarative schema is the new feature in Magento to do database operations of creating and updating database tables. This is one of the major changes introduced by the Magento team in 2.3 and it replaces the old approach of creating InstallSchema & UpgradeSchema scripts. Why Declarative Schema? Before declarative schema, developers need to write different schema scripts in each version of a module. And when a customer upgrades Magento to a version several releases ahead of the installed version, the upgrade scripts between those two versions will still be executed. This increases the complexity to track changes with every upgrade script. And new declarative schema approach allows developers to declare the final desired state of the database and has the system adjust to it automatically. What is the use of db_schema.xml? Before Magento 2.3, whatever database operations developers were writing in InstallSchema & UpgradeSchema scripts are replaced by the db_schema.xml file. So now...

Missing crypt key for upgrading Magento

This is my first experience setting up a local docker environment for my project which is in Magento 2 Cloud edition. While doing setup by following Magento docs, I got stuck in the step "Deploy adobe commerce in the Docker Container". Here I was facing the issue: "Missing crypt key for upgrading Magento". Reason : I have taken a DB backup from my staging environment, it has a crypt_key stored which is used by Magento for encrypting the secured data. Solution : If you are not using docker for local setup then, you can simply update the crypt_key value in the app/etc/env.php file. But if you are using docker for your local setup, then you need to include your crypt_key in the config.php inside the .docker folder in your Magento root directory. Open the  .docker/config.php file. Then, search for the key MAGENTO_CLOUD_VARIABLES and add your crypt_key like below: Once you add the crypt_key in the file, try to again execute the  docker-compose run --rm deploy cloud-d...