Add value in DB table (Migration)
I need to insert a value into the database. The table already exists, just insert one more
And I need Insert 9 newcode newcode_title
I created new file
mysql4-upgrade-0.7.9-0.8.0.php
And it includes
<?php
$installer = $this;
$installer->startSetup();
???????????
$installer->endSetup();
magento-1.9 database migration
add a comment |
I need to insert a value into the database. The table already exists, just insert one more
And I need Insert 9 newcode newcode_title
I created new file
mysql4-upgrade-0.7.9-0.8.0.php
And it includes
<?php
$installer = $this;
$installer->startSetup();
???????????
$installer->endSetup();
magento-1.9 database migration
add a comment |
I need to insert a value into the database. The table already exists, just insert one more
And I need Insert 9 newcode newcode_title
I created new file
mysql4-upgrade-0.7.9-0.8.0.php
And it includes
<?php
$installer = $this;
$installer->startSetup();
???????????
$installer->endSetup();
magento-1.9 database migration
I need to insert a value into the database. The table already exists, just insert one more
And I need Insert 9 newcode newcode_title
I created new file
mysql4-upgrade-0.7.9-0.8.0.php
And it includes
<?php
$installer = $this;
$installer->startSetup();
???????????
$installer->endSetup();
magento-1.9 database migration
magento-1.9 database migration
edited 25 mins ago
Teja Bhagavan Kollepara
3,01241949
3,01241949
asked Mar 12 '18 at 8:19
Павел КушнеревичПавел Кушнеревич
13012
13012
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You can try:
$installer->startSetup();
$installer->getConnection()->addColumn($installer->getTable('[YOUR TABLE]'),'new_column', array(
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
'nullable' => false,
'length' => 255,
'after' => null,
'comment' => 'New column'
));
$installer->endSetup();
EDIT:
To insert data to your table you must create a model in your module and call the save action:
$model = Mage::getModel('modulename/modelname');
$model->setData($yourData);
$model->save();
Ty for answer.U add new column, but I need just a new value of the table. For example id picture_code picture_code_tittle 9 newcode newcodetitle
– Павел Кушнеревич
Mar 12 '18 at 8:42
if I have AI id, I shouldn't include it at the$yourData
?
– Павел Кушнеревич
Mar 12 '18 at 9:05
If it's autoincrement you don't have to add an id.
– Adrian Z.
Mar 12 '18 at 9:07
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%2f216931%2fadd-value-in-db-table-migration%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can try:
$installer->startSetup();
$installer->getConnection()->addColumn($installer->getTable('[YOUR TABLE]'),'new_column', array(
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
'nullable' => false,
'length' => 255,
'after' => null,
'comment' => 'New column'
));
$installer->endSetup();
EDIT:
To insert data to your table you must create a model in your module and call the save action:
$model = Mage::getModel('modulename/modelname');
$model->setData($yourData);
$model->save();
Ty for answer.U add new column, but I need just a new value of the table. For example id picture_code picture_code_tittle 9 newcode newcodetitle
– Павел Кушнеревич
Mar 12 '18 at 8:42
if I have AI id, I shouldn't include it at the$yourData
?
– Павел Кушнеревич
Mar 12 '18 at 9:05
If it's autoincrement you don't have to add an id.
– Adrian Z.
Mar 12 '18 at 9:07
add a comment |
You can try:
$installer->startSetup();
$installer->getConnection()->addColumn($installer->getTable('[YOUR TABLE]'),'new_column', array(
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
'nullable' => false,
'length' => 255,
'after' => null,
'comment' => 'New column'
));
$installer->endSetup();
EDIT:
To insert data to your table you must create a model in your module and call the save action:
$model = Mage::getModel('modulename/modelname');
$model->setData($yourData);
$model->save();
Ty for answer.U add new column, but I need just a new value of the table. For example id picture_code picture_code_tittle 9 newcode newcodetitle
– Павел Кушнеревич
Mar 12 '18 at 8:42
if I have AI id, I shouldn't include it at the$yourData
?
– Павел Кушнеревич
Mar 12 '18 at 9:05
If it's autoincrement you don't have to add an id.
– Adrian Z.
Mar 12 '18 at 9:07
add a comment |
You can try:
$installer->startSetup();
$installer->getConnection()->addColumn($installer->getTable('[YOUR TABLE]'),'new_column', array(
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
'nullable' => false,
'length' => 255,
'after' => null,
'comment' => 'New column'
));
$installer->endSetup();
EDIT:
To insert data to your table you must create a model in your module and call the save action:
$model = Mage::getModel('modulename/modelname');
$model->setData($yourData);
$model->save();
You can try:
$installer->startSetup();
$installer->getConnection()->addColumn($installer->getTable('[YOUR TABLE]'),'new_column', array(
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
'nullable' => false,
'length' => 255,
'after' => null,
'comment' => 'New column'
));
$installer->endSetup();
EDIT:
To insert data to your table you must create a model in your module and call the save action:
$model = Mage::getModel('modulename/modelname');
$model->setData($yourData);
$model->save();
edited Mar 12 '18 at 9:00
answered Mar 12 '18 at 8:31
Adrian Z.Adrian Z.
594310
594310
Ty for answer.U add new column, but I need just a new value of the table. For example id picture_code picture_code_tittle 9 newcode newcodetitle
– Павел Кушнеревич
Mar 12 '18 at 8:42
if I have AI id, I shouldn't include it at the$yourData
?
– Павел Кушнеревич
Mar 12 '18 at 9:05
If it's autoincrement you don't have to add an id.
– Adrian Z.
Mar 12 '18 at 9:07
add a comment |
Ty for answer.U add new column, but I need just a new value of the table. For example id picture_code picture_code_tittle 9 newcode newcodetitle
– Павел Кушнеревич
Mar 12 '18 at 8:42
if I have AI id, I shouldn't include it at the$yourData
?
– Павел Кушнеревич
Mar 12 '18 at 9:05
If it's autoincrement you don't have to add an id.
– Adrian Z.
Mar 12 '18 at 9:07
Ty for answer.U add new column, but I need just a new value of the table. For example id picture_code picture_code_tittle 9 newcode newcodetitle
– Павел Кушнеревич
Mar 12 '18 at 8:42
Ty for answer.U add new column, but I need just a new value of the table. For example id picture_code picture_code_tittle 9 newcode newcodetitle
– Павел Кушнеревич
Mar 12 '18 at 8:42
if I have AI id, I shouldn't include it at the
$yourData
?– Павел Кушнеревич
Mar 12 '18 at 9:05
if I have AI id, I shouldn't include it at the
$yourData
?– Павел Кушнеревич
Mar 12 '18 at 9:05
If it's autoincrement you don't have to add an id.
– Adrian Z.
Mar 12 '18 at 9:07
If it's autoincrement you don't have to add an id.
– Adrian Z.
Mar 12 '18 at 9:07
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%2f216931%2fadd-value-in-db-table-migration%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