How to create a table in the database in Magento using install scriptMySQL install script doesn't run?How to truncate magento table using collection?Create folder during install modulecustom table creation by install script errorProgrammatically create site categories using an install scriptHow to add new column to existing table in Magento programmatically?How to add my table in database and save the table?How to insert the script, just after the start of the head tag using layout file in magentoadding a image/logo to attributeCreate php script to truncate table

Where to place an artificial gland in the human body?

How do I run a game when my PCs have different approaches to combat?

Can GPL and BSD licensed applications be used for government work?

Do I need another Schengen Visa

Is the apartment I want to rent a scam?

Why are angular mometum and angular velocity not necessarily parallel, but linear momentum and linear velocity are always parallel?

No-cloning theorem does not seem precise

How to write a sincerely religious protagonist without preaching or affirming or judging their worldview?

Why are so many countries still in the Commonwealth?

Would it be a good idea to memorize relative interval positions on guitar?

How can I prevent corporations from growing their own workforce?

Do Rabbis get punished in Heaven for wrong interpretations or claims?

Using "Kollege" as "university friend"?

Why did Saturn V not head straight to the moon?

Determine if a triangle is equilateral, isosceles, or scalene

Character Frequency in a String

how to add 1 milliseconds on a datetime string?

How can I receive packages while in France?

The seven story archetypes. Are they truly all of them?

Can two figures have the same area, perimeter, and same number of segments have different shape?

What does the minus sign mean in measurements in datasheet footprint drawings?

This message is flooding my syslog, how to find where it comes from?

Grid/table with lots of buttons

What was the rationale behind 36 bit computer architectures?



How to create a table in the database in Magento using install script


MySQL install script doesn't run?How to truncate magento table using collection?Create folder during install modulecustom table creation by install script errorProgrammatically create site categories using an install scriptHow to add new column to existing table in Magento programmatically?How to add my table in database and save the table?How to insert the script, just after the start of the head tag using layout file in magentoadding a image/logo to attributeCreate php script to truncate table






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








3















I am new to Magento, and I am trying to create a table in the database using an install script. THE WEB SITE IS HOSTED. I followed few tutorials, and they all look same. I followed every step, but the table is not created. Can some one tell me where I have gone wrong? I created the following file:



app/code/local/Sitepoint/Articles/etc/config.xml



It contains following code:



<global>
<models>
<articles>
<class>Sitepoint_Articles_Model</class> <!-- Model class files -->
<resourceModel>articles_mysql4</resourceModel> <!--Resource model -->
</articles>
<articles_mysql4>
<class>Sitepoint_Articles_Model_Mysql4</class>
<entities>
<articles>
<table>articles</table> <!-- Db table name -->
</articles>
</entities>
</articles_mysql4>
</models>
<resources>
<articles_setup>
<setup>
<module>Sitepoint_Articles</module>
</setup>
<connection>
<use>core_setup</use>
</connection>
</articles_setup>
<articles_write>
<connection>
<use>core_write</use>
</connection>
</articles_write>
<articles_read>
<connection>
<use>core_read</use>
</connection>
</articles_read>
</resources>
</global>


Then I created following file:



app/code/local/Sitepoint/Articles/sql/articles_setup/mysql4-install-0.1.0.php



Which has the following code:



<?php
$installer = $this;
$installer->startSetup();
$installer->run("-- DROP TABLE IF EXISTS $this->getTable('articles');
CREATE TABLE $this->getTable('articles') (
`articles_id` int(11) unsigned NOT NULL auto_increment,
`title` varchar(255) NOT NULL default '',
`short_desc` text NOT NULL default '',
`long_desc` text NOT NULL default '',
`status` tinyint(2) NOT NULL default '0',
`created_time` datetime NULL,
`update_time` datetime NULL,
PRIMARY KEY (`articles_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
");
$installer->endSetup();
?>


I followed this tutorial => https://www.sitepoint.com/magento-install-upgrade-data-scripts-explained/ but the tables are not created. I tried few other tutorials, and they all provide the same way. Can someone help me?










share|improve this question
























  • So are you using magento 1 or magento 2?

    – Jurģis Toms Liepiņš
    Nov 13 '17 at 10:26

















3















I am new to Magento, and I am trying to create a table in the database using an install script. THE WEB SITE IS HOSTED. I followed few tutorials, and they all look same. I followed every step, but the table is not created. Can some one tell me where I have gone wrong? I created the following file:



app/code/local/Sitepoint/Articles/etc/config.xml



It contains following code:



<global>
<models>
<articles>
<class>Sitepoint_Articles_Model</class> <!-- Model class files -->
<resourceModel>articles_mysql4</resourceModel> <!--Resource model -->
</articles>
<articles_mysql4>
<class>Sitepoint_Articles_Model_Mysql4</class>
<entities>
<articles>
<table>articles</table> <!-- Db table name -->
</articles>
</entities>
</articles_mysql4>
</models>
<resources>
<articles_setup>
<setup>
<module>Sitepoint_Articles</module>
</setup>
<connection>
<use>core_setup</use>
</connection>
</articles_setup>
<articles_write>
<connection>
<use>core_write</use>
</connection>
</articles_write>
<articles_read>
<connection>
<use>core_read</use>
</connection>
</articles_read>
</resources>
</global>


Then I created following file:



app/code/local/Sitepoint/Articles/sql/articles_setup/mysql4-install-0.1.0.php



Which has the following code:



<?php
$installer = $this;
$installer->startSetup();
$installer->run("-- DROP TABLE IF EXISTS $this->getTable('articles');
CREATE TABLE $this->getTable('articles') (
`articles_id` int(11) unsigned NOT NULL auto_increment,
`title` varchar(255) NOT NULL default '',
`short_desc` text NOT NULL default '',
`long_desc` text NOT NULL default '',
`status` tinyint(2) NOT NULL default '0',
`created_time` datetime NULL,
`update_time` datetime NULL,
PRIMARY KEY (`articles_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
");
$installer->endSetup();
?>


I followed this tutorial => https://www.sitepoint.com/magento-install-upgrade-data-scripts-explained/ but the tables are not created. I tried few other tutorials, and they all provide the same way. Can someone help me?










share|improve this question
























  • So are you using magento 1 or magento 2?

    – Jurģis Toms Liepiņš
    Nov 13 '17 at 10:26













3












3








3








I am new to Magento, and I am trying to create a table in the database using an install script. THE WEB SITE IS HOSTED. I followed few tutorials, and they all look same. I followed every step, but the table is not created. Can some one tell me where I have gone wrong? I created the following file:



app/code/local/Sitepoint/Articles/etc/config.xml



It contains following code:



<global>
<models>
<articles>
<class>Sitepoint_Articles_Model</class> <!-- Model class files -->
<resourceModel>articles_mysql4</resourceModel> <!--Resource model -->
</articles>
<articles_mysql4>
<class>Sitepoint_Articles_Model_Mysql4</class>
<entities>
<articles>
<table>articles</table> <!-- Db table name -->
</articles>
</entities>
</articles_mysql4>
</models>
<resources>
<articles_setup>
<setup>
<module>Sitepoint_Articles</module>
</setup>
<connection>
<use>core_setup</use>
</connection>
</articles_setup>
<articles_write>
<connection>
<use>core_write</use>
</connection>
</articles_write>
<articles_read>
<connection>
<use>core_read</use>
</connection>
</articles_read>
</resources>
</global>


Then I created following file:



app/code/local/Sitepoint/Articles/sql/articles_setup/mysql4-install-0.1.0.php



Which has the following code:



<?php
$installer = $this;
$installer->startSetup();
$installer->run("-- DROP TABLE IF EXISTS $this->getTable('articles');
CREATE TABLE $this->getTable('articles') (
`articles_id` int(11) unsigned NOT NULL auto_increment,
`title` varchar(255) NOT NULL default '',
`short_desc` text NOT NULL default '',
`long_desc` text NOT NULL default '',
`status` tinyint(2) NOT NULL default '0',
`created_time` datetime NULL,
`update_time` datetime NULL,
PRIMARY KEY (`articles_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
");
$installer->endSetup();
?>


I followed this tutorial => https://www.sitepoint.com/magento-install-upgrade-data-scripts-explained/ but the tables are not created. I tried few other tutorials, and they all provide the same way. Can someone help me?










share|improve this question
















I am new to Magento, and I am trying to create a table in the database using an install script. THE WEB SITE IS HOSTED. I followed few tutorials, and they all look same. I followed every step, but the table is not created. Can some one tell me where I have gone wrong? I created the following file:



app/code/local/Sitepoint/Articles/etc/config.xml



It contains following code:



<global>
<models>
<articles>
<class>Sitepoint_Articles_Model</class> <!-- Model class files -->
<resourceModel>articles_mysql4</resourceModel> <!--Resource model -->
</articles>
<articles_mysql4>
<class>Sitepoint_Articles_Model_Mysql4</class>
<entities>
<articles>
<table>articles</table> <!-- Db table name -->
</articles>
</entities>
</articles_mysql4>
</models>
<resources>
<articles_setup>
<setup>
<module>Sitepoint_Articles</module>
</setup>
<connection>
<use>core_setup</use>
</connection>
</articles_setup>
<articles_write>
<connection>
<use>core_write</use>
</connection>
</articles_write>
<articles_read>
<connection>
<use>core_read</use>
</connection>
</articles_read>
</resources>
</global>


Then I created following file:



app/code/local/Sitepoint/Articles/sql/articles_setup/mysql4-install-0.1.0.php



Which has the following code:



<?php
$installer = $this;
$installer->startSetup();
$installer->run("-- DROP TABLE IF EXISTS $this->getTable('articles');
CREATE TABLE $this->getTable('articles') (
`articles_id` int(11) unsigned NOT NULL auto_increment,
`title` varchar(255) NOT NULL default '',
`short_desc` text NOT NULL default '',
`long_desc` text NOT NULL default '',
`status` tinyint(2) NOT NULL default '0',
`created_time` datetime NULL,
`update_time` datetime NULL,
PRIMARY KEY (`articles_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
");
$installer->endSetup();
?>


I followed this tutorial => https://www.sitepoint.com/magento-install-upgrade-data-scripts-explained/ but the tables are not created. I tried few other tutorials, and they all provide the same way. Can someone help me?







magento-1.9 magento-1.7 magento-1.8






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 18 '17 at 2:42









mtr.web

7975 silver badges16 bronze badges




7975 silver badges16 bronze badges










asked Nov 13 '17 at 3:23









Sadisha_NadiejSadisha_Nadiej

161 bronze badge




161 bronze badge












  • So are you using magento 1 or magento 2?

    – Jurģis Toms Liepiņš
    Nov 13 '17 at 10:26

















  • So are you using magento 1 or magento 2?

    – Jurģis Toms Liepiņš
    Nov 13 '17 at 10:26
















So are you using magento 1 or magento 2?

– Jurģis Toms Liepiņš
Nov 13 '17 at 10:26





So are you using magento 1 or magento 2?

– Jurģis Toms Liepiņš
Nov 13 '17 at 10:26










3 Answers
3






active

oldest

votes


















0














You have to specify the version of the module in the config.xml in your etc module folder. See below:



<?xml version="1.0"?>
<config>
<modules>
<Sitepoint_Articles>
<version>0.1.0</version>
</Sitepoint_Articles>
</modules>
<global>
<models>
<articles>
<class>Sitepoint_Articles_Model</class> <!-- Model class files -->
<resourceModel>articles_mysql4</resourceModel> <!--Resource model -->
</articles>
<articles_mysql4>
<class>Sitepoint_Articles_Model_Mysql4</class>
<entities>
<articles>
<table>articles</table> <!-- Db table name -->
</articles>
</entities>
</articles_mysql4>
</models>
<resources>
<articles_setup>
<setup>
<module>Sitepoint_Articles</module>
</setup>
<connection>
<use>core_setup</use>
</connection>
</articles_setup>
<articles_write>
<connection>
<use>core_write</use>
</connection>
</articles_write>
<articles_read>
<connection>
<use>core_read</use>
</connection>
</articles_read>
</resources>
</global>
</config>


And make sure that you registered the modules from



app/etc/modules/Sitepoint_Articles.xml and with a content:



<?xml version="1.0"?>
<config>
<modules>
<Sitepoint_Articles>
<active>true</active>
<codePool>local</codePool>
</Sitepoint_Articles>
</modules>
</config>


Hope that helps.






share|improve this answer






























    0














    please check your setup_module table and if you find your module then



    delete from setup_module where module like '%your_module%';


    then run from the command line



    php magentobin setup:upgrade





    share|improve this answer

























    • He is not using Magento 2, he is using Magento 1 based on the structure of the files.

      – Ner
      Nov 14 '17 at 0:48


















    0














    Create a new file mysql4-upgrade-0.1.0-0.1.1.php and put same below code in it



    <?php
    $installer = $this;
    $installer->startSetup();
    $installer->run("-- DROP TABLE IF EXISTS $this->getTable('articles');
    CREATE TABLE $this->getTable('articles') (
    `articles_id` int(11) unsigned NOT NULL auto_increment,
    `title` varchar(255) NOT NULL default '',
    `short_desc` text NOT NULL default '',
    `long_desc` text NOT NULL default '',
    `status` tinyint(2) NOT NULL default '0',
    `created_time` datetime NULL,
    `update_time` datetime NULL,
    PRIMARY KEY (`articles_id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    ");
    $installer->endSetup();
    ?>


    second thing you need to change version in app/code/local/Sitepoint/Articles/etc/config.xml file.



    just change from



    <modules>
    <Sitepoint_Articles>
    <version>0.1.0</version>
    </Sitepoint_Articles>
    </modules>


    to.



    <modules>
    <Sitepoint_Articles>
    <version>0.1.1</version>
    </Sitepoint_Articles>
    </modules>


    This is the steps for upgrade script.



    Hope this will help.






    share|improve this answer

























      Your Answer








      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "479"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f201113%2fhow-to-create-a-table-in-the-database-in-magento-using-install-script%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      You have to specify the version of the module in the config.xml in your etc module folder. See below:



      <?xml version="1.0"?>
      <config>
      <modules>
      <Sitepoint_Articles>
      <version>0.1.0</version>
      </Sitepoint_Articles>
      </modules>
      <global>
      <models>
      <articles>
      <class>Sitepoint_Articles_Model</class> <!-- Model class files -->
      <resourceModel>articles_mysql4</resourceModel> <!--Resource model -->
      </articles>
      <articles_mysql4>
      <class>Sitepoint_Articles_Model_Mysql4</class>
      <entities>
      <articles>
      <table>articles</table> <!-- Db table name -->
      </articles>
      </entities>
      </articles_mysql4>
      </models>
      <resources>
      <articles_setup>
      <setup>
      <module>Sitepoint_Articles</module>
      </setup>
      <connection>
      <use>core_setup</use>
      </connection>
      </articles_setup>
      <articles_write>
      <connection>
      <use>core_write</use>
      </connection>
      </articles_write>
      <articles_read>
      <connection>
      <use>core_read</use>
      </connection>
      </articles_read>
      </resources>
      </global>
      </config>


      And make sure that you registered the modules from



      app/etc/modules/Sitepoint_Articles.xml and with a content:



      <?xml version="1.0"?>
      <config>
      <modules>
      <Sitepoint_Articles>
      <active>true</active>
      <codePool>local</codePool>
      </Sitepoint_Articles>
      </modules>
      </config>


      Hope that helps.






      share|improve this answer



























        0














        You have to specify the version of the module in the config.xml in your etc module folder. See below:



        <?xml version="1.0"?>
        <config>
        <modules>
        <Sitepoint_Articles>
        <version>0.1.0</version>
        </Sitepoint_Articles>
        </modules>
        <global>
        <models>
        <articles>
        <class>Sitepoint_Articles_Model</class> <!-- Model class files -->
        <resourceModel>articles_mysql4</resourceModel> <!--Resource model -->
        </articles>
        <articles_mysql4>
        <class>Sitepoint_Articles_Model_Mysql4</class>
        <entities>
        <articles>
        <table>articles</table> <!-- Db table name -->
        </articles>
        </entities>
        </articles_mysql4>
        </models>
        <resources>
        <articles_setup>
        <setup>
        <module>Sitepoint_Articles</module>
        </setup>
        <connection>
        <use>core_setup</use>
        </connection>
        </articles_setup>
        <articles_write>
        <connection>
        <use>core_write</use>
        </connection>
        </articles_write>
        <articles_read>
        <connection>
        <use>core_read</use>
        </connection>
        </articles_read>
        </resources>
        </global>
        </config>


        And make sure that you registered the modules from



        app/etc/modules/Sitepoint_Articles.xml and with a content:



        <?xml version="1.0"?>
        <config>
        <modules>
        <Sitepoint_Articles>
        <active>true</active>
        <codePool>local</codePool>
        </Sitepoint_Articles>
        </modules>
        </config>


        Hope that helps.






        share|improve this answer

























          0












          0








          0







          You have to specify the version of the module in the config.xml in your etc module folder. See below:



          <?xml version="1.0"?>
          <config>
          <modules>
          <Sitepoint_Articles>
          <version>0.1.0</version>
          </Sitepoint_Articles>
          </modules>
          <global>
          <models>
          <articles>
          <class>Sitepoint_Articles_Model</class> <!-- Model class files -->
          <resourceModel>articles_mysql4</resourceModel> <!--Resource model -->
          </articles>
          <articles_mysql4>
          <class>Sitepoint_Articles_Model_Mysql4</class>
          <entities>
          <articles>
          <table>articles</table> <!-- Db table name -->
          </articles>
          </entities>
          </articles_mysql4>
          </models>
          <resources>
          <articles_setup>
          <setup>
          <module>Sitepoint_Articles</module>
          </setup>
          <connection>
          <use>core_setup</use>
          </connection>
          </articles_setup>
          <articles_write>
          <connection>
          <use>core_write</use>
          </connection>
          </articles_write>
          <articles_read>
          <connection>
          <use>core_read</use>
          </connection>
          </articles_read>
          </resources>
          </global>
          </config>


          And make sure that you registered the modules from



          app/etc/modules/Sitepoint_Articles.xml and with a content:



          <?xml version="1.0"?>
          <config>
          <modules>
          <Sitepoint_Articles>
          <active>true</active>
          <codePool>local</codePool>
          </Sitepoint_Articles>
          </modules>
          </config>


          Hope that helps.






          share|improve this answer













          You have to specify the version of the module in the config.xml in your etc module folder. See below:



          <?xml version="1.0"?>
          <config>
          <modules>
          <Sitepoint_Articles>
          <version>0.1.0</version>
          </Sitepoint_Articles>
          </modules>
          <global>
          <models>
          <articles>
          <class>Sitepoint_Articles_Model</class> <!-- Model class files -->
          <resourceModel>articles_mysql4</resourceModel> <!--Resource model -->
          </articles>
          <articles_mysql4>
          <class>Sitepoint_Articles_Model_Mysql4</class>
          <entities>
          <articles>
          <table>articles</table> <!-- Db table name -->
          </articles>
          </entities>
          </articles_mysql4>
          </models>
          <resources>
          <articles_setup>
          <setup>
          <module>Sitepoint_Articles</module>
          </setup>
          <connection>
          <use>core_setup</use>
          </connection>
          </articles_setup>
          <articles_write>
          <connection>
          <use>core_write</use>
          </connection>
          </articles_write>
          <articles_read>
          <connection>
          <use>core_read</use>
          </connection>
          </articles_read>
          </resources>
          </global>
          </config>


          And make sure that you registered the modules from



          app/etc/modules/Sitepoint_Articles.xml and with a content:



          <?xml version="1.0"?>
          <config>
          <modules>
          <Sitepoint_Articles>
          <active>true</active>
          <codePool>local</codePool>
          </Sitepoint_Articles>
          </modules>
          </config>


          Hope that helps.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 13 '17 at 7:37









          NerNer

          7142 silver badges19 bronze badges




          7142 silver badges19 bronze badges























              0














              please check your setup_module table and if you find your module then



              delete from setup_module where module like '%your_module%';


              then run from the command line



              php magentobin setup:upgrade





              share|improve this answer

























              • He is not using Magento 2, he is using Magento 1 based on the structure of the files.

                – Ner
                Nov 14 '17 at 0:48















              0














              please check your setup_module table and if you find your module then



              delete from setup_module where module like '%your_module%';


              then run from the command line



              php magentobin setup:upgrade





              share|improve this answer

























              • He is not using Magento 2, he is using Magento 1 based on the structure of the files.

                – Ner
                Nov 14 '17 at 0:48













              0












              0








              0







              please check your setup_module table and if you find your module then



              delete from setup_module where module like '%your_module%';


              then run from the command line



              php magentobin setup:upgrade





              share|improve this answer















              please check your setup_module table and if you find your module then



              delete from setup_module where module like '%your_module%';


              then run from the command line



              php magentobin setup:upgrade






              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Nov 14 '17 at 3:36









              Ner

              7142 silver badges19 bronze badges




              7142 silver badges19 bronze badges










              answered Nov 13 '17 at 9:06









              babunbabun

              163 bronze badges




              163 bronze badges












              • He is not using Magento 2, he is using Magento 1 based on the structure of the files.

                – Ner
                Nov 14 '17 at 0:48

















              • He is not using Magento 2, he is using Magento 1 based on the structure of the files.

                – Ner
                Nov 14 '17 at 0:48
















              He is not using Magento 2, he is using Magento 1 based on the structure of the files.

              – Ner
              Nov 14 '17 at 0:48





              He is not using Magento 2, he is using Magento 1 based on the structure of the files.

              – Ner
              Nov 14 '17 at 0:48











              0














              Create a new file mysql4-upgrade-0.1.0-0.1.1.php and put same below code in it



              <?php
              $installer = $this;
              $installer->startSetup();
              $installer->run("-- DROP TABLE IF EXISTS $this->getTable('articles');
              CREATE TABLE $this->getTable('articles') (
              `articles_id` int(11) unsigned NOT NULL auto_increment,
              `title` varchar(255) NOT NULL default '',
              `short_desc` text NOT NULL default '',
              `long_desc` text NOT NULL default '',
              `status` tinyint(2) NOT NULL default '0',
              `created_time` datetime NULL,
              `update_time` datetime NULL,
              PRIMARY KEY (`articles_id`)
              ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
              ");
              $installer->endSetup();
              ?>


              second thing you need to change version in app/code/local/Sitepoint/Articles/etc/config.xml file.



              just change from



              <modules>
              <Sitepoint_Articles>
              <version>0.1.0</version>
              </Sitepoint_Articles>
              </modules>


              to.



              <modules>
              <Sitepoint_Articles>
              <version>0.1.1</version>
              </Sitepoint_Articles>
              </modules>


              This is the steps for upgrade script.



              Hope this will help.






              share|improve this answer



























                0














                Create a new file mysql4-upgrade-0.1.0-0.1.1.php and put same below code in it



                <?php
                $installer = $this;
                $installer->startSetup();
                $installer->run("-- DROP TABLE IF EXISTS $this->getTable('articles');
                CREATE TABLE $this->getTable('articles') (
                `articles_id` int(11) unsigned NOT NULL auto_increment,
                `title` varchar(255) NOT NULL default '',
                `short_desc` text NOT NULL default '',
                `long_desc` text NOT NULL default '',
                `status` tinyint(2) NOT NULL default '0',
                `created_time` datetime NULL,
                `update_time` datetime NULL,
                PRIMARY KEY (`articles_id`)
                ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
                ");
                $installer->endSetup();
                ?>


                second thing you need to change version in app/code/local/Sitepoint/Articles/etc/config.xml file.



                just change from



                <modules>
                <Sitepoint_Articles>
                <version>0.1.0</version>
                </Sitepoint_Articles>
                </modules>


                to.



                <modules>
                <Sitepoint_Articles>
                <version>0.1.1</version>
                </Sitepoint_Articles>
                </modules>


                This is the steps for upgrade script.



                Hope this will help.






                share|improve this answer

























                  0












                  0








                  0







                  Create a new file mysql4-upgrade-0.1.0-0.1.1.php and put same below code in it



                  <?php
                  $installer = $this;
                  $installer->startSetup();
                  $installer->run("-- DROP TABLE IF EXISTS $this->getTable('articles');
                  CREATE TABLE $this->getTable('articles') (
                  `articles_id` int(11) unsigned NOT NULL auto_increment,
                  `title` varchar(255) NOT NULL default '',
                  `short_desc` text NOT NULL default '',
                  `long_desc` text NOT NULL default '',
                  `status` tinyint(2) NOT NULL default '0',
                  `created_time` datetime NULL,
                  `update_time` datetime NULL,
                  PRIMARY KEY (`articles_id`)
                  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
                  ");
                  $installer->endSetup();
                  ?>


                  second thing you need to change version in app/code/local/Sitepoint/Articles/etc/config.xml file.



                  just change from



                  <modules>
                  <Sitepoint_Articles>
                  <version>0.1.0</version>
                  </Sitepoint_Articles>
                  </modules>


                  to.



                  <modules>
                  <Sitepoint_Articles>
                  <version>0.1.1</version>
                  </Sitepoint_Articles>
                  </modules>


                  This is the steps for upgrade script.



                  Hope this will help.






                  share|improve this answer













                  Create a new file mysql4-upgrade-0.1.0-0.1.1.php and put same below code in it



                  <?php
                  $installer = $this;
                  $installer->startSetup();
                  $installer->run("-- DROP TABLE IF EXISTS $this->getTable('articles');
                  CREATE TABLE $this->getTable('articles') (
                  `articles_id` int(11) unsigned NOT NULL auto_increment,
                  `title` varchar(255) NOT NULL default '',
                  `short_desc` text NOT NULL default '',
                  `long_desc` text NOT NULL default '',
                  `status` tinyint(2) NOT NULL default '0',
                  `created_time` datetime NULL,
                  `update_time` datetime NULL,
                  PRIMARY KEY (`articles_id`)
                  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
                  ");
                  $installer->endSetup();
                  ?>


                  second thing you need to change version in app/code/local/Sitepoint/Articles/etc/config.xml file.



                  just change from



                  <modules>
                  <Sitepoint_Articles>
                  <version>0.1.0</version>
                  </Sitepoint_Articles>
                  </modules>


                  to.



                  <modules>
                  <Sitepoint_Articles>
                  <version>0.1.1</version>
                  </Sitepoint_Articles>
                  </modules>


                  This is the steps for upgrade script.



                  Hope this will help.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 14 '17 at 4:10









                  MeetanshiMeetanshi

                  7401 gold badge3 silver badges21 bronze badges




                  7401 gold badge3 silver badges21 bronze badges



























                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Magento Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f201113%2fhow-to-create-a-table-in-the-database-in-magento-using-install-script%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

                      Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

                      Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form