Add value in DB table (Migration)












0















I need to insert a value into the database. The table already exists, just insert one more
enter image description here



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();









share|improve this question





























    0















    I need to insert a value into the database. The table already exists, just insert one more
    enter image description here



    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();









    share|improve this question



























      0












      0








      0








      I need to insert a value into the database. The table already exists, just insert one more
      enter image description here



      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();









      share|improve this question
















      I need to insert a value into the database. The table already exists, just insert one more
      enter image description here



      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 25 mins ago









      Teja Bhagavan Kollepara

      3,01241949




      3,01241949










      asked Mar 12 '18 at 8:19









      Павел КушнеревичПавел Кушнеревич

      13012




      13012






















          1 Answer
          1






          active

          oldest

          votes


















          1














          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();





          share|improve this answer


























          • 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












          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%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









          1














          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();





          share|improve this answer


























          • 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
















          1














          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();





          share|improve this answer


























          • 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














          1












          1








          1







          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();





          share|improve this answer















          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();






          share|improve this answer














          share|improve this answer



          share|improve this answer








          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



















          • 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


















          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%2f216931%2fadd-value-in-db-table-migration%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

          What other Star Trek series did the main TNG cast show up in?

          Berlina muro

          Berlina aerponto