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;
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
add a comment |
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
So are you using magento 1 or magento 2?
– Jurģis Toms Liepiņš
Nov 13 '17 at 10:26
add a comment |
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
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
magento-1.9 magento-1.7 magento-1.8
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
add a comment |
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
add a comment |
3 Answers
3
active
oldest
votes
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.
add a comment |
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
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
add a comment |
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.
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
add a comment |
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.
add a comment |
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.
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.
answered Nov 13 '17 at 7:37
NerNer
7142 silver badges19 bronze badges
7142 silver badges19 bronze badges
add a comment |
add a comment |
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
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
add a comment |
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
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
add a comment |
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
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
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
add a comment |
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
add a comment |
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.
add a comment |
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.
add a comment |
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.
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.
answered Nov 14 '17 at 4:10
MeetanshiMeetanshi
7401 gold badge3 silver badges21 bronze badges
7401 gold badge3 silver badges21 bronze badges
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
So are you using magento 1 or magento 2?
– Jurģis Toms Liepiņš
Nov 13 '17 at 10:26