Challenge 4.1: Installer Script

As we learned previously Magento SQL scripts are useful for creating tables and setting data when an extension is installed. In the book example we only included the for creating the registry_entity table.

But we are missing two related table registry_type and registry_items. Let's take a look at each of the missing tables and breakdown the code:


The registry type table is used to identify the different types of registries (Wedding, Baby Registry, Birthday, Bachelor(ed) Part, and so on)


The item table is used to to store the relationship between a product and a registry. This table is very simple and only stores the product_id and the matching registry_id.


Once we had added the previous code to our installation script we should have the following file: