Questions tagged [upgrade-script]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
0 answers
706 views

How to define a dependency between data patch and upgrade script

As described in the DevDocs you can define data patch dependencies. To define a dependency in a patch, add the method public static function getDependencies() to the patch class and return the ...
Daniel's user avatar
  • 2,179
1 vote
1 answer
79 views

Using composition in patches / install scripts

TL;DR: Is there a way to declare virtual types and different arguments in di.xml of a module and have that configuration be picked up when the module gets installed without calling bin/magento module:...
Marius's user avatar
  • 197k
1 vote
1 answer
197 views

Magento 2 Saving store configuration programatically in upgrade script

I want to save store configuration programtically but I'm just getting one problem after another. Firstly I wanted to use Writer class but since it only updates core_config_data table it doesn't work ...
czs's user avatar
  • 179
2 votes
2 answers
3k views

Magento 2 Add new Customer Attribute via UpgradeSchema

I have a module that has customer attributes added via the InstallSchema Script, however I have an UpgradeSchema script to also add more customer attributes; Error below when running update in ...
BENN1TH's user avatar
  • 814
3 votes
3 answers
1k views

Question about UpgradeSchema and UpgradeData files

Sorry, I'm new in using Magento 2. In my UpgradeSchema.php I would like to add a column to my table and in my UpgradeData.php I would like to add new records to the table. In both the file i have ...
Foo79's user avatar
  • 31
0 votes
0 answers
41 views

Custom module created is not working in server,works good in local environment

We have created a custom module inside app/code and in upgrade schema script we have increased the module.xml version to add a new column to the existing table.Will it cause any issues?I am not able ...
sahana's user avatar
  • 329
1 vote
3 answers
5k views

Magento 2 : UpgradeData.php not working

I need to add a custom attribute (contact_number) for customer in Magento2 via an existing module, so I am using UpgradeData.php. Can anyone please tell what I have missed out. use Magento\Framework\...
Narendra Vyas's user avatar
1 vote
2 answers
2k views

Magento 1.9 custom module version not upgrading?

Am trying to upgrade a module. The core_resource table is not updating and sql resource is not running. I have tried lots of possibilities. My config.xml <modules> <...
Radhu's user avatar
  • 159
1 vote
2 answers
2k views

Magento 2 : Creating widget using install script

I have a custom module for megamenu. I want to create some widgets predefined for the module when the customer installs this module. I have added the below script for creating the widget(widget type: ...
Vindhuja's user avatar
  • 1,355
0 votes
1 answer
421 views

Magento 2: UpgradeData duplicates static blocks when I try to update them

My code looks like this: /** * @var \Magento\Cms\Model\BlockFactory */ private $_blockFactory; ... $this->_blockFactory ->setStoreId(0) ->load('some-identifier', '...
Pini's user avatar
  • 907
2 votes
1 answer
474 views

Data upgrade data doesn't work in Magento 1

This is my upgrade script: //mynamespace/mymodule/data/upgrade-1.0.0-1.0.1.php $eavAttributes = [ [ 'entity_type_id' => '12', 'attribute_code' => 'reason_contact', '...
Attila Naghi's user avatar
  • 3,775
0 votes
1 answer
301 views

Can't able to create table in magento 1 upgrade script

I am trying to create a script to create a table in my custom module. I tried many method but i thing there is a minor issue in my script. I want sure what is mistake. Config file Path - app\code\...
user1620882's user avatar
0 votes
1 answer
101 views

Magento 2: upgrade module with EAV attributes

I am working on a custom module with EAV attributes / models. I have added some attribute in my setup script and the module is installed and working. Now as the requirement changed, I need to add a ...
Abid Malik's user avatar
1 vote
0 answers
141 views

Magento 2.1.9 upgrade to 2.2.0 - Error on setup:upgrade with Magento_Sales table get error when upgrade

Upgrading magento from 2.1.9 to 2.2.0 and during the automatic bin/magento setup:upgrade process, it runs all upgrades fine until it reaches the magento_sales table where it produces this error. ...
Rahul Katoch's user avatar
  • 1,099
1 vote
0 answers
66 views

Area Code not set when Model is used while using Upgrade Data Script

I have following code in UpgradeData.php protected $test; public function __construct( \Vendor\ModuleName\Model\Test $test ) { $this->test = $test; } public function ...
Nausif's user avatar
  • 1,514
4 votes
1 answer
4k views

Setting attribute labels programmatically

I'm trying to set labels for attributes for each language. For example I want to translate Price (in Stores > Attributes > Product > Price > Manage labels) for all the store views. However, I can't ...
Cake's user avatar
  • 346
0 votes
2 answers
63 views

Upgrade file only working on localhost

I have a file named upgrade-1.0.3-1.0.4.php under CSB/Customer/sql/csb_customer_setup, and I updated the code in config.xml, under CSB/etc, to <version>1.0.4</version>. On localhost the ...
LeCodeur's user avatar
  • 366
0 votes
0 answers
287 views

Upgrade script continuously running and giving an error?

I write an upgrade script to alter on of my modules table. My script is below mysql4-upgrade-3.0.8-3.0.9.php $installer = $this; /* @var $installer Mage_Eav_Model_Entity_Setup */ $installer->...
Mujahidh's user avatar
  • 2,651
0 votes
1 answer
469 views

How can I add attribute to product properly?

I'm trying to add attribute to product entity. It seems that my upgrade script run, because module version is upgraded in core_resource table. However I can't find it at catalog attributes listing. ...
Codium's user avatar
  • 103
0 votes
1 answer
785 views

Wrong attribute set ID in general tab manage product

Where is a problem ? $installer = $this; $installer->startSetup(); Mage::log("other_setup_addAttribute UPGRADE 0.0.2 -> 0.0.3 START"); $setup = new Mage_Eav_Model_Entity_Setup('...
PЯINCƎ's user avatar
  • 11.5k
0 votes
1 answer
394 views

How to call model in UpgradeData Magento 2

i have a model that i can be called via controller like this protected $_sync; public function __construct(\Magento\Framework\App\Action\Context $context, \Lime\Hello\Model\SyncFactory $sync)...
Idham Choudry's user avatar
5 votes
2 answers
5k views

How to add dropdown attribute to custom module in magento 2.0

I wanted to add dropdown attribute called 'customer type' with drop down options 'buyer' and 'seller' to my custom module. How can I make it to my upgrade schema?
sagar sapkota's user avatar
2 votes
3 answers
1k views

Flush DDL Cache

I created an update script to create some new fields in the database for my custom model. When I am trying to save the model the new fields are not being saved. I thing Magento caches the DDL ...
Zvonimir Burić's user avatar
2 votes
2 answers
5k views

How to create MySQL Triggers through setup script

I placed trigger statement in installer script but it didn't create in MySQL. Created File here Custom/Module/Setup/UpgradeSchema.php <?php namespace Custom\Module\Setup; use Magento\Framework\...
Mahendra Jella's user avatar
1 vote
2 answers
242 views

Magento 1.9 : Base table or view not found when try to add column to table

I am trying to upgrade my module table by using the upgrade script. I am getting the error Base table or view not found. Please, check below the config.xml file, install script and upgrade script code:...
mudit mehrotra's user avatar
9 votes
6 answers
3k views

Magento2: Setup Script not loaded

I've been banging my head for a few hours now. I have setup a small Magento 2 module. It is enabled everything is working except the Setup scripts never run. Actually from my diagnosis right now, they ...
Michaël St-Georges's user avatar
15 votes
3 answers
20k views

How to add a CMS block programmatically in Magento 2?

I need to add a CMS block via an install/upgrade script. I've already figured out how to add "normal" CMS pages as seen in the script below. But since I can't find any way to add CMS blocks in Magento ...
user avatar
0 votes
1 answer
117 views

M1: Setup upgrade/update scripts concurrent visitors

I haven't been able to get any clear answer on this and it seems like a lot of very experienced people have different views on this. So the question is: I've made a setup install/update script + ...
OZZIE's user avatar
  • 552
2 votes
1 answer
359 views

Programatically Updating A Categories Parent ID

I am currently in the process of reordering an entire category tree via an upgrade script. I am aware that you can update the parent ID via the following: $category->setParentId($value); $...
Ryan Copeland's user avatar
7 votes
2 answers
2k views

Add custom image upload attribute to product

I Have tried to add new image upload attribute to Magento Product using sql upgrade script, but I got the error message like: Invalid backend model specified: catalog/...
Oleg's user avatar
  • 239
0 votes
0 answers
44 views

How to upgrade magento 1.8.1.0 to magento 1.9.2.4 [duplicate]

I am in a need to upgrade my magento store from v1.8.1.0 to v1.9.2.4. Can anyone please tell me the way to achieve this? What are the stuffs needed to be taken care of?NOTE: I am using nginx server. ...
Anurag Khandelwal's user avatar
0 votes
3 answers
4k views

Update static blocks programatically > throws error

We're having some problems with our upgrade script updating the store. The error that we get is: A block identifier with the same properties already exists in the selected store. I've post the ...
Stephen Johnston's user avatar
0 votes
1 answer
872 views

redirect loop on installation [duplicate]

Midst installation it has decided to crop up with the error: This webpage has a redirect loop ERR_TOO_MANY_REDIRECTS I have attempted to delete var/cache and var/session but still the error is ...
Vaishal Patel's user avatar
0 votes
1 answer
4k views

data: current version - none, required version - 2.0.0

I am trying to create a magento plugin I have create every thing required. when I enabled the plugin then it shows the below error. What I am missing here. Please upgrade your database: Run "bin/...
Yogendra - eCommerce Developer's user avatar
2 votes
1 answer
62 views

When implementing an SQL upgrade script, do I need an install script for stores that have never had a previous version of the module?

I understand how to execute an install or upgrade script with my Magento module. My question is, when someone installs the latest version of a module and has never had a previous version installed, ...
tylersDisplayName's user avatar
3 votes
1 answer
269 views

Update custom module database

I'm trying to update my custom module's database table. An so far i have done this. Created mysql4-upgrade-0.1.0-0.1.1 - With the following code <?php $installer = $this; $connection = $...
Patrick Knudsen's user avatar
10 votes
5 answers
19k views

How to programmatically add attribute option values in data upgrade script?

I want to programmatically add new product option values in a data upgade script of my module. How can I do this?
Anton Belonovich's user avatar
1 vote
0 answers
592 views

Cannot add foreign key constraint When Upgrade 1.9.2.3 from 1.4.0.1 [closed]

Try to upgrade a magento system from 1.4.0.1 to lastest 1.9.2.3. Getting error to Mage_Customer module's at upgrade installer file mysql4-upgrade-1.4.0.0.7-1.4.0.0.8.php Throwing error: a:5:{i:0;s:...
Amit Bera's user avatar
  • 76.7k
1 vote
2 answers
496 views

Running a script only one time

I want to remove an attribute from its attribute set, programmatically. I have this code: Mage::getModel('catalog/product_attribute_set_api') ->attributeRemove($attributeId, $attributeSetId); ...
clemtoy's user avatar
  • 133
13 votes
3 answers
27k views

Magento 2 Add "VARCHAR" type field into custom table

Please look at the current core database adapter file(Table.php) located at: magento-2/vendor/magento/framework/DB/Ddl: <?php /** * Copyright © 2015 Magento. All rights reserved. * See COPYING....
Vicky Dev's user avatar
  • 1,984
10 votes
1 answer
23k views

Create Magento 2 Upgrade Script to add/update new field into custom module table

Anybody have any idea/suggestion about creating Magento 2(CE Stable version) Upgrade Script(in custom-module) for adding/updating new field into custom table ? I know about "InstallSchema" but is ...
Vicky Dev's user avatar
  • 1,984
9 votes
2 answers
10k views

Magento 2 how to save custom field added in the form of customer group?

I've added some custom fields to the form of customer group by using upgradeSchema.php. After that I found that the original fields like customer group code and tax id are saved by using setter ...
Ricky.C's user avatar
  • 2,164
0 votes
2 answers
1k views

New custom attribute not showing on catalog

I already defined a custom attribute "Internal Title" under General Tab. Now I want to add another new custom attribute but this does not work Tried with different approaches I found (upgradeand ...
xhallix's user avatar
  • 692
1 vote
1 answer
130 views

mysql upgrade script did not work / run after patch

The mysql upgrade file did not update the database after a patch. I checked the code in the mysql upgrade file and the changes in the file weren't applied to the database. Is there a way to re-run ...
JMC's user avatar
  • 262
3 votes
1 answer
3k views

Tables permission_block and permission_variable did not get created after SUPEE-6788

I installed the patch SUPEE-6788 on my local website and everything went fine. I uploaded all modified files to our production website but tables permission_block and permission_variable did not get ...
Michele's user avatar
  • 53
0 votes
1 answer
88 views

Why Magento Core team doesn't notify us when modifies duplicate customer email addresses in upgrade script?

I was monitoring SQL queries during upgrade from Magento 1.5 to Magento 1.9.2.1 I noticed that in upgrade-1.6.2.0.1-1.6.2.0.2.php of Customer module Magento Core team modifies all duplicate customer ...
ceckoslab's user avatar
  • 837
29 votes
2 answers
50k views

Magento2 : How to database schema upgrade

I am working on magento custom module, in module have Setup\InstallSchema.php file which is installed before. i have added some more database fields in InstallSchema.php so i want to update table ...
Suresh Chikani's user avatar
3 votes
1 answer
140 views

Install script version logic: When are which upgrade scripts executed?

I found an interesting behavior today: I accidently named a data upgrade script data-upgrade-0.1.20-0.1.20.php where it should have been data-upgrade-0.1.19-0.1.20.php, and it actually has been ...
Fabian Schmengler's user avatar
2 votes
3 answers
5k views

Upgrade script not working

I've added two category attributes successfully to magento admin. However when I run an upgrade script to add another, "core_resource" takes note of my module update but doesn't install the new ...
Stefkay's user avatar
  • 410
0 votes
1 answer
3k views

How can I update values in database table using an upgrade script?

I am trying to UPDATE values inside of the directory_country table using a data-upgrade script but hit a brick wall with the syntax for updating a table using this method as I am trying to avoid using ...
user1704524's user avatar
  • 2,483