After the first tutorial on how to create a simple module in Magento 2, we hope you can create a module by yourself easily. If you still have problem, don’t hesitate to discuss with us through our facebook fanpage. In this second blog post, I will introduce you how to create a module with custom database table in Magento 2.
6. Step 3: Create the installation file.
Create
file: app/code/Tutorial/SimpleNews/Setup/InstallSchema.php
Purpose: declare and create the custom table
=> Go to our blog tutorial for full source code
7. Step 4: Activate the module.
Active this module by
opening:
app/etc/config.php file
Add this line into it
Step 4.1:
8. Step 4: Activate the module.
Open the
Command in
Windows
Go to Magento
root folder
Run this
command line
to install module
Module: binmagento setup:upgrade
Step 4.2:
9. Step 4: Activate the module.
Step 4.3: Check database: the tutorial_simplenews table is
created successfully