Questions tagged [setup-script]

Installer/Update script

Filter by
Sorted by
Tagged with
2 votes
2 answers
2k views

MG2 Integration give error Unable to post data to consumer due to an unexpected error

I'm follow the http://devdocs.magento.com/guides/v2.0/howdoi/webapi/integration.html and i have an error when i try do activates the integrator. [2017-06-20 05:22:08] main.CRITICAL: Exception: Notice:...
1 vote
1 answer
2k views

Magento 2 module “data_version - not upgrading"?

In Magento 2.0 I have written UpgradeData and UpgradeSchema and I have changed the setup_version in module.xml. After that I run php bin/magento setup:upgrade After this in the database, ...
2 votes
3 answers
4k views

Magento 2 : Check Static Block with same identifier in InstallData Script

I am creating module which will create static block & cms page at time of site transfer. So my InstallData file like below : class InstallData implements InstallDataInterface { /** * @var ...
0 votes
0 answers
19 views

Return product attribute object after creation

I've made a class to create product attributes on the fly. After creating it I want to return it immediately. However getAttributeByCode() returns NULL. When I start another process the ...
0 votes
2 answers
79 views

Create custom attribute for specifi product

i'm tring to create a custom attribute only for a specific product. Into apply_to field i have setted a list "configurable, grouped" , a array('configurable', 'grouped') or single type, but ...
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 ...
3 votes
5 answers
4k views

Magento2 not executing InstallSchema.php or UpgradeSchema.php

I've created a custom module, and I see the row in the setup_module table. When I change my version and run magento setup:upgrade, the version number updates as well. However, the table I defined is ...
1 vote
3 answers
7k views

Adding attribute - all possible options

I was searching throughout net i have not found complete tutorial. The case is I need complete configuration for newly added attribute (for product) and explantation of use of each one, adding it with ...
2 votes
3 answers
313 views

2 module setup scripts dependence

I have 2 modules: ModuleA and ModuleB. ModuleA creates some categories in a data install script. ModuleB creates a new category attribute in a data install script. (the modules do other things, but ...
3 votes
1 answer
1k views

What is the order of execution of setup scripts in a module?

1) Can there be multiple install scripts in the custom module? For example: data-install-1.0.0.php data-install-1.0.1.php 2) Assuming I have the following scripts inside app/code/local/Company/...
6 votes
1 answer
2k views

Install/Upgrade Scripts - Can they run multiple times when multiple users are hitting the site before they are done?

We have a couple of updates that we'd like to run by way of a module's upgrade script. One of them takes about 5 minutes to complete. The problem here that we are not sure about is that the site ...
2 votes
0 answers
259 views

Magento 2 - How To Generate Custom Data Fixture For Integration Testing

I'm required to generate 1000+ orders to test an integration + address verification. I've come across this data generation technique in my search and wish to create my own data fixture based off: ...
0 votes
2 answers
61 views

Magento 1.9: Sql setup Stripe module not execute

I'm installing throught composer the Stripe module, the problem is that when I installed the site, where the module work, crash because can't find the table in Database. I don't know why the setup sql ...
8 votes
6 answers
20k views

Magento 2 module install error "data: current version - none, required version 2.0.0"

I'm getting the following error when I try to install my extension. Please upgrade your database: Run "bin/magento setup:upgrade" from the Magento root directory. The following modules are outdated: ...
4 votes
2 answers
10k views

Error: DDL statements are not allowed in transactions while running setup:upgrade. Running Data Patch

Magento 2.3.1 After making the data patch @ following location vendor/ModuleName/Setup/Patch/Data/AddMyColumnPatch.php code given below for AddMyColumnPatch.php. When I run bin/magento setup:...
8 votes
6 answers
10k views

Magento 2: Create customer group programatically

I'd like to know if it's possible (if so, how) to programmatically create a new customer group using the Magento 2 framework. Ideally I'd like to do this in a setup class. Looking at the ...
9 votes
2 answers
8k views

Magento 2 :- Add select attribute to category

I want to add a select/dropdown attribute to a category and display it in the backend to let the store owner select it. After some research I found out the following to do: Create an attribute via ...
0 votes
0 answers
140 views

boolean order attribute won't save correctly in Magento 1.9

I have created my boolean order attribute /* @var $installer \Mage_Sales_Model_Resource_Setup */ $installer = $this; $installer->startSetup(); $smsAttribute = [ 'type' => 'int', '...
3 votes
2 answers
2k views

Magento 2 new order attribute

I have been trying to create a new order attribute in Magento 2, but not successful yet. I have created a new module and this is already showing. I added the different codes available in my setup ...
9 votes
6 answers
4k 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 ...
0 votes
1 answer
741 views

Customer custom attribute value did not save using rest api in magento 2.3?

Customer custom attribute value did not save using rest API in Magento 2.3? API URL: http://127.0.0.1/magento2/rest/V1/customers Method: POST My POST JSON request data is : { "customer": ...
3 votes
2 answers
1k views

Field dependency for category attributes

I add attributes in setup script, all is configured properly and attributes are added to a new tab called "MyGroup": $installer = $this; $installer->startSetup(); $installer->addAttribute('...
0 votes
2 answers
271 views

Database not creating tables for new extensions on bin/magento setup:upgrade. Declarative Schema is not up to date

I installed Magento 2.3 successfully, with custom style sheet and Mageplaza Blog ext which all works fine. I wanted to install a slider module and I have done this through ssh. Composer installs the ...
0 votes
1 answer
21 views

Why do the Magento 1 setup scripts still have to be prefixed with 'mysql4'?

MySQL4 is largely obsolete now, even Magento 1 latest versions send a warning if you use Mysql4 prefixed classes. I searched if the setup file names also had this deprecation but couldn't find a thing....
2 votes
1 answer
141 views

Setup Script Not Working Properly

I need to add attribute through a setup script.Attribute properties are working,but the frontend properties are not applied as specified in the setup script.For example, visible_on_front ...
1 vote
1 answer
69 views

Magento 2 - Customer Attribute not being saved

Below is code for creating customer attribute. namespace Namespace\Modulename\Setup; use Magento\Customer\Model\Customer; use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\...
0 votes
2 answers
1k views

Magento 2 error 500 after adding a module

I added a module by these command php bin/magento module:status php bin/magento module:enable module Everything was fine then I run this php bin/magento setup:upgrade After this everything messed ...
1 vote
2 answers
3k views

Recurring.php and RecurringData.php

Can anybody explain the purpose of this two files in Setup folder? When should I use it? I know, that it fires every time when I run setup:upgrade But I want to know at least one example of usage. ...
13 votes
3 answers
28k 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....
1 vote
3 answers
129 views

Update module to run alter command

I have created a module Vendor/Module I have added sql setup script in it. The module is working fine. Now I need to alter table and add come more columns in the table. To do this I need to add new ...
2 votes
2 answers
337 views

Magento 2.3 What are the profits of using db_schema.xml instead of using setup script?

Magento 2.3 used db_schema.xml instead of setup script. What are the benefits of using db_schema.xml over setup script?
2 votes
1 answer
2k views

Insert multiple records to multiple custom tables through install script in magento2

I have created multiple table schema using setup script like below. Setup/InstallSchema.php namespace Vendor\Module\Setup; use Magento\Framework\Setup\InstallSchemaInterface; use Magento\...
1 vote
2 answers
1k views

Create Column in Quote Payment Table in magento2

i want to add new column in Quote payment table i tried script but not working <?php namespace Ibnab\Additional\Setup; use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\...
2 votes
1 answer
1k views

How to save input value to database magento2

I am absolutely new in magento. I have made new input called 'name' under email input in app/design/frontend/NewVendor/NewTheme/Magento_Newsletter/templates/subscribe.phtml <div class="block ...
0 votes
0 answers
319 views

How to add a Megamenu programmatically in Magento 2?

I need to add Megamenu via an install/upgrade script. I've added my megamenu. I've figured out which tables get updated when I add Megamenu. The table which gets updated is mgs_megamenu ...
1 vote
2 answers
2k views

error on running raw sql query in upgradeData.php magento 2

I have created my own module and in UpgradeData.php script I am writing my own, mysql query but it gives me an error when I run bin/magento setup:upgrade to run the setup script files Recoverable ...
1 vote
1 answer
934 views

Setup Script throws Error : Call to undefined method Mage_Core_Model_Resource_Setup::addAttribute()

I am following a tutorial from the book of Roman Zenner & Vinai Kopp called "Magento - The Handbook for Developers" (german: Magento - Das Handbuch für Entwickler). Snippet from config.xml <...
0 votes
0 answers
487 views

setup:upgrade stuck exit at installing Data

I have created following Setup Script <?php namespace Anshu\Custom\Setup; use Magento\Framework\Setup\ModuleDataSetupInterface; use Magento\Framework\Setup\ModuleContextInterface; use Magento\...
2 votes
4 answers
5k views

How to assign a theme in Magento 2 using a setup script?

How can we assign a theme in Magento 2.1 to a store using setup scripts? Thank you
2 votes
0 answers
128 views

Insert data into core db table

I need to run this SQL query on Magento, but since I have a multi-tenant solution, it need to be done through Data/Install scripts as it will run every time a new client comes in. What should I use? ...
2 votes
1 answer
71 views

Adding new regions won't persist

I followed an example and created a custom extension that would add some regions to the directory_country_region & directory_country_region_name tables. I want to make sure that the data I write ...
2 votes
1 answer
2k views

Remove all customers where * is * programmatically

I want to remove all customers that have the following string in their first name: 'http://' (spam customers that have links in their first names). Is there a good way to remove these ...
1 vote
1 answer
541 views

Install script not running

I know there's a million of these questions with answers but I still can't solve this. It does create the line in the core_resource table, but my install script is supposed to die to show it's running,...
3 votes
4 answers
13k views

assign attribute to attribute set

How to assign particular attribute set to newly created attribute? My code is eavSetup->addAttribute( \Magento\Catalog\Model\Product::ENTITY, 'test_demo221', [ //...
1 vote
0 answers
159 views

Magento 2 : Call a function at the time of module installation

I want to call a function to send some store information through api call at the time of my custom module installation. Is there any event observer for this? How can we do it? Thanks. class ...
2 votes
1 answer
644 views

Magento 2.2: InstallData script never called even though no entry in setup_module

Hello I have created a module in accordance to the tutorial at Magento Docs My InstallData class looks like this: <?php /** * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt ...
29 votes
2 answers
51k 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 ...
2 votes
1 answer
389 views

How to activate a new module in magento 1 this module should create a table

I am trying to activate a new module in Magento 1. Here are my actions step-by-step: I created a new file in /app/etc/modules, called : Mage_ContactMessage.xml : I created a new folder in /app/code/...
1 vote
0 answers
44 views

Problems While Creating Product Attribute With InstallData

I've created InstallData for creating product attribute with default options to be set yes like, used_in_product_listing and is_used_for_promo_rules Probelm is only used_in_product_listing is ...
1 vote
0 answers
43 views

When Installer Class Execute

I am trying to Implement same thing Magento is doing when we run web installer wizard. Magento is creating sample data (Attributes, Products, Categories) using Setup\SampleData\InstallerInterface ...