Magento Expert Forum - Improve your Magento experience

Results 1 to 13 of 13

How to create custom table in Magento2 Module?

  1. #1

  2. #2

  3. #3
    Junior Member
    Join Date
    Sep 2016
    Posts
    186
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Last edited by vishnu; 13-03-2019 at 08:04 AM.

  4. #4
    New member
    Join Date
    May 2018
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    hello please helping me to find out that how we can print or access custom collection.
    Mageplaza\HelloWorld\Block\Post.php

    -----------------
    we Iqbal Engineering Company deal in all type of Wholesale Saloon Chairs and Barber chair in pakistan

  5. #5
    Junior Member
    Join Date
    May 2018
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    For Beginners such like me, It's helpful

  6. #6
    Junior Member
    Join Date
    Jun 2018
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thanks for sharing with us

  7. #7
    Junior Member fay_khattak's Avatar
    Join Date
    Jan 2016
    Location
    Karachi, Pakistan
    Posts
    52
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Default

    To create custom tables for Magento 2 module, setup scripts can come in handy in such cases. Setup scripts in Magento 2 are essential when writing custom modules. We have 6 different types of Setup Scripts that can be used with our custom modules:

    - InstallSchema
    - UpgradeSchema
    - InstallData
    - UpgradeData
    - Recurring
    - Uninstall

    Setup scripts in Magento 2 are triggered using the Command Line Interface (CLI). To know more about it, check out this blog post:

    https://www.cloudways.com/blog/setup...-in-magento-2/

  8. #8
    Junior Member
    Join Date
    Sep 2017
    Posts
    48
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Default

    Thank you for the informative post.

  9. #9
    Junior Member
    Join Date
    Sep 2018
    Location
    United Kingdom
    Posts
    165
    Thanks
    0
    Thanked 4 Times in 4 Posts

    Default

    Step 1: Create a new module (Tutorial_SimpleNews) with the following structure:
    Step 2: Create configuration file. ...
    Step 3: Create the installation file. ...
    Step 4: Activate the module.

  10. #10
    Junior Member
    Join Date
    Sep 2018
    Location
    United Kingdom
    Posts
    165
    Thanks
    0
    Thanked 4 Times in 4 Posts

    Default

    Make a module with custom database table in Magento 2. Stage 1: Create another module (Tutorial_SimpleNews) with the accompanying structure: Step 2: Create setup record. Stage 3: Create the establishment record. Stage 3: Activate the module.

  11. #11
    Junior Member
    Join Date
    Sep 2018
    Location
    United Kingdom
    Posts
    118
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Magento 2 has four kinds of such contents: InstallSchema, InstallData, UpgradeSchema, Include another module and confirm that a table with the information was made.

  12. #12
    Junior Member
    Join Date
    Sep 2018
    Location
    United Kingdom
    Posts
    145
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    Run the overhaul contents and confirm that the table has changed. Stage 1: Create another module. Stage 2: Create an InstallSchema content. Stage 3: Create an InstallData content. Stage 4: Add another module and check that a table with information was made. Stage 5: Create an UpgradeSchema content. Stage 6: Create the UpgradeData content.

  13. #13
    Junior Member
    Join Date
    Sep 2018
    Location
    United Kingdom
    Posts
    143
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Run the upgrade scripts and verify that the table has changed. Step 1: Create a new module. Step 2: Create an InstallSchema script. Step 3: Create an InstallData script. Step 4: Add a new module and verify that a table with data was created. Step 5: Create an UpgradeSchema script. Step 6: Create the UpgradeData script.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •