Questions tagged [setup-script]

Installer/Update script

Filter by
Sorted by
Tagged with
1
vote
1answer
41 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\...
1
vote
1answer
51 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:...
1
vote
3answers
80 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
2answers
39 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
1answer
143 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\...
2
votes
1answer
60 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 ...
1
vote
2answers
197 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\...
0
votes
0answers
37 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
2answers
259 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 ...
0
votes
0answers
32 views

multiple update scripts queries in magento 2 setup script

I have few insert queries for Magento tables, as I have referred this link https://devdocs.magento.com/videos/fundamentals/add-a-new-table-to-database/ How to run multiple update scripts based on ...
0
votes
1answer
74 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
2answers
159 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 ...
0
votes
0answers
86 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
0answers
62 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
1answer
43 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
1answer
382 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 ...
0
votes
0answers
60 views

magento 2 how to install raw sql file or statements using setup scripts

Can any one suggest me how to use install scripts to execute raw sql statements or file.
1
vote
1answer
130 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,...
1
vote
0answers
52 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
1answer
42 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
0answers
21 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 ...
1
vote
0answers
30 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 ...
2
votes
0answers
28 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 ...
0
votes
1answer
97 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 ...
0
votes
2answers
558 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 ...
0
votes
2answers
623 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. ...
0
votes
1answer
53 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\...
1
vote
1answer
99 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 ...
2
votes
1answer
152 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'; $...
1
vote
0answers
49 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 ...
2
votes
1answer
251 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 ...
5
votes
3answers
494 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)....
1
vote
1answer
77 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. ...
1
vote
2answers
1k 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:...
2
votes
2answers
1k 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 ...
1
vote
1answer
217 views

Magento 2 : How to Create Simple Product by UpgradeSchema?

How do I create a simple product programmatically using UpgradeSchema?
0
votes
2answers
907 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 ...
3
votes
2answers
1k 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/...
9
votes
2answers
3k 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 ...
2
votes
1answer
330 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, ...
0
votes
1answer
697 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?
3
votes
1answer
1k 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 ...
1
vote
2answers
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' ...
1
vote
1answer
287 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.
0
votes
1answer
187 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 ...
1
vote
1answer
771 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 ...
3
votes
3answers
9k 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?
1
vote
4answers
6k 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
4answers
3k 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
1
vote
1answer
895 views

Magento2 setup not creating table

I have used setup to create table but script is not creating the table. I have also removed the entry from setup_module table but still, it didn't work. InstallSchema.php <?php namespace Vendor\...