If you are developing custom Magento extensions, you might have database script which require to be properly run when you install the extension. Sometimes while installation, it may happen where the extension is installed but database script is missing. Here the setup scripts come in place where you need to run extension setup script from Magento 2 root to properly install the extension.

Let’s have a look at setup script to run extension from Magento 2 root.

Here, as a sample code, I’m showing to create a category and product attribute through setup script.

Running above setup script from Magento 2 root will instantly install the extension with related missing database. Hope this blog has helped you to properly install extension. If you get confused or have questions regarding, feel free to comment, I’ll be happy to help you.

Click to rate this post!
[Total: 3 Average: 5]