2022 Developer Survey is open! Take survey.

Questions tagged [setup-script]

Installer/Update script

Filter by
Sorted by
Tagged with
0 votes
2 answers
29 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 ...
user avatar
  • 1
0 votes
0 answers
78 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', '...
user avatar
  • 521
0 votes
1 answer
469 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": ...
user avatar
  • 3,131
0 votes
2 answers
187 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 ...
user avatar
  • 1
0 votes
1 answer
18 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....
user avatar
  • 103
1 vote
1 answer
62 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\...
user avatar
4 votes
2 answers
6k 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:...
user avatar
  • 493
1 vote
3 answers
101 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 ...
user avatar
2 votes
2 answers
253 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?
user avatar
  • 141
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\...
user avatar
  • 1,729
2 votes
1 answer
718 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 ...
user avatar
  • 591
1 vote
2 answers
976 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\...
user avatar
  • 203
0 votes
0 answers
245 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 ...
user avatar
  • 799
1 vote
2 answers
1k 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 ...
user avatar
  • 799
1 vote
1 answer
811 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 <...
user avatar
  • 2,402
2 votes
2 answers
991 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 ...
user avatar
  • 21
0 votes
0 answers
463 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\...
user avatar
  • 8,558
2 votes
0 answers
101 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? ...
user avatar
2 votes
1 answer
67 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 ...
user avatar
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 ...
user avatar
1 vote
1 answer
484 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,...
user avatar
1 vote
0 answers
112 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 ...
user avatar
  • 53
2 votes
1 answer
253 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/...
user avatar
1 vote
0 answers
26 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 ...
user avatar
  • 3,654
1 vote
0 answers
37 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 ...
user avatar
  • 3,654
2 votes
0 answers
30 views

Send email to admin during extension installation?

I want to send an email to admin (website owner) to notify that our extension has been installed in your web store. For that, I have developing an extension but not getting any way to shoot the email ...
user avatar
0 votes
1 answer
157 views

Magento Catalog Setup Script Can't Complete [closed]

I'm having trouble getting some of my modules to complete their setup scripts. Looking at the core_resource table shows that catalog_setup has a higher version than data version. This has been a ...
user avatar
  • 9
0 votes
2 answers
1k views

Magento 2 - InstallSchema.php does not create table [closed]

I have created a module that has a setup that creates a table for me. However, the table does not exist after installing the module. I don't know why. Error: SQLSTATE[42S02]: Base table or view ...
user avatar
  • 67
1 vote
2 answers
2k 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. ...
user avatar
0 votes
1 answer
64 views

Can we create product attribute without select options, and add it later?

I have the following setup file in my custom module on Vendor\Module\Setup\InstallData.php: <?php namespace Vendor\Module\Setup; use \Magento\Catalog\Model\Product; use \Magento\Eav\Setup\...
user avatar
  • 2,625
2 votes
1 answer
230 views

How do I find all valid array keys for the EavSetup::addAttribute method?

When adding an EAV attribute in an install script (Setup/InstallData.php or Setup/UpgradeData.php), the third argument to the addAttribute method is an array of information customizing the created ...
user avatar
  • 431
2 votes
1 answer
215 views

change input renderer which already added by setup script

I have a custom setup script in a module like this <?php $installer = new Mage_Catalog_Model_Resource_Setup('core_setup'); $installer->startSetup(); $attributeSetDefault = 'Default'; $...
user avatar
  • 2,048
1 vote
0 answers
57 views

Is it necessary to addIndex() on Setup Script?

I'm writing a setup script for my new module. I found that there are many setup scripts in InstallSchema.php contains addIndex(). But after I found some info on W3School, seems it's just a performance ...
user avatar
  • 2,625
2 votes
1 answer
566 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 ...
user avatar
  • 381
7 votes
3 answers
1k views

Magento2 What's the point of having both InstallSchema and UpgradeSchema

If UpgradeSchema/UpgradeData are executed when installing and upgrading a module what's the point of having InstallSchema/InstallData (besides just having a well-named file that is only executed once)....
user avatar
  • 727
1 vote
1 answer
226 views

How to make a specific script run only once in the lifetime of an extension

The requirement is that I want to execute a script upon the installation of my extension. But I want to make sure that it runs only once and then never again. I tried doing this via Setup Resources. ...
user avatar
  • 85
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:...
user avatar
2 votes
2 answers
3k 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 ...
user avatar
  • 1,443
1 vote
1 answer
379 views

Magento 2 : How to Create Simple Product by UpgradeSchema?

How do I create a simple product programmatically using UpgradeSchema?
user avatar
  • 2,757
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 ...
user avatar
3 votes
2 answers
2k views

Magento 2.1: Not add table into database

I follow this tutorial: https://www.pierrefay.com/en/magento2-training/install-upgrade-setup.html but i didn't add table into database, i had do anything in tutorial. From here: Go to /app/code/Pfay/...
user avatar
9 votes
2 answers
7k 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 ...
user avatar
  • 251
2 votes
1 answer
523 views

Magento 2 testing module setup

How is it possible to test module setup in Magento2 ? I have following setup class: class InstallSchema implements InstallSchemaInterface { public function install(SchemaSetupInterface $setup, ...
user avatar
  • 131
0 votes
1 answer
1k views

How to create custom atribute set using upgradeData in magento 2

I am trying to create custom attribute set by using upgradeData script in magento 2, but it doesn't create. Can anyone give me an advice?
user avatar
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 ...
user avatar
1 vote
2 answers
2k views

Adding an attribute programmatically in Magento 2.1

I am creating a product attribute for sorting which will be int type : where I am getting following error: PHP Fatal error: Uncaught Error: Class 'Magento\Catalog\Model\Resource\Eav\Attribute' ...
user avatar
2 votes
1 answer
424 views

Prevent Magento setup resources from running automatically

What is the setting within app/etc/local.xml to prevent setup resources from being triggered to run automatically? I have seen this somewhere but cannot locate it now.
user avatar
  • 757
0 votes
1 answer
268 views

Custom Customer attribute that auto_increments

I need a custom customer attribute of type int that should start with some 5-digit number and auto-increments each time a new customer is created. Approach 1: Or should I make a simple int type ...
user avatar
1 vote
1 answer
1k views

Why my google map is not showing at contact us page? [closed]

My google map is not displaying and due to script problem. How to resolve this? my script code is as follows function initialize() { var pos = new google.maps.LatLng(, ); var ...
user avatar
4 votes
3 answers
14k views

Magento 2 - setup:install & setup:upgrade

I have updated the code in my custom module and run setup:install already. Do I still need to run setup:upgrade?
user avatar
  • 4,169