How monish-trivedi/declarativeschema works
Project type and purpose
• This is a Magento 2 module (“DeclarativeSchema”) that leverages Magento’s declarative schema system to manage database structure changes (e.g., adding indexes) via XML.
• It plugs into the Magento framework at setup/upgrade time to modify the MySQL schema based on your “etc/db_schema.xml” and whitelist.
File structure
• Top‐level:
• README.md – high‐level description
• registration.php – module registration with Magento
• etc/module.xml – declares module name and setup versions
• etc/db_schema.xml – your declarative‐schema instructions (table definitions, indexes)
• etc/db_schema_whitelist.json – tracks “allowed” operations for incremental upgrades
• No “frontend” or “controllers” here: purely a backend, setup‐phase module.
README for additional insights
• Confirms focus on database operations (adding an index to “custom_table”)
• Demonstrates use‐case: declare INDEX_SEVERITY in XML, run Magento upgrade, index gets created.
Final advice
• Be exhaustive: include module registration, DI, schema files, processor, adapter, and database.