Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

Questions tagged [upgradeschema]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
11
votes
3answers
19k views

Add column Upgrade Schema Magento 2

I want to insert new field for database table in my custom extension using upgrade schema by following this post,but i got an error saying : [Zend_Db_Statement_Exception] ...
4
votes
2answers
1k views

How to add new table in existing module using UpgradeSchema in Magento 2

class UpgradeSchema implements UpgradeSchemaInterface { public function upgrade(SchemaSetupInterface $setup,ModuleContextInterface $context){ $setup->startSetup(); if (...
3
votes
1answer
75 views

How to rename an existing custom table in Magento 2?

I created a table with name "Redeem_blanace" using InstallSchema.php as: class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} * @SuppressWarnings(PHPMD....
3
votes
2answers
2k views

Make column unique in install schema script

I want my column to be unique. It is not an EAV attribute. I have seen some tutorials, where indexes are unique, but I am not sure it is not the same, as making column unique (or am I wrong?). Is ...
3
votes
3answers
1k views

Area code not set: Area code must be set before starting a session when UpgradeData

I'm using magento verison 2.2.5 and i try to use Setup/UpgradeData.php to run a model function to insert data into database from an external API. but when i run php bin/magento setup:upgrade i always ...
2
votes
1answer
69 views

I'm creating new Attribute for Category and facing an issue in Magento 2.X

My Upgrade Script : <?php namespace MyCompany\MyModule\Setup; use Magento\Framework\Module\Setup\Migration; use Magento\Framework\Setup\UpgradeSchemaInterface; use Magento\Framework\Setup\...
2
votes
3answers
359 views

How to add foreign key in db_schema.xml

I'm using magento 2.3 to create a custom module, i tried to create database tables for my custom module in etc/db_schema.xml like this: <table comment="province Table" engine="innodb" name="...
2
votes
0answers
148 views

Magento integration test conflict with new customer eav attribute

I tried to run my integration test using bin/magento dev:tests:run integration but i always got an error like this: Module 'Company_CutomerExtraAttribute': Upgrading data... [Magento\Framework\...
2
votes
1answer
1k views

magento 2 UpgradeSchema not working

I have already created a table with name tutorial_simplenews.I want to add new column to that table.my code is below. <?php /** * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See ...
1
vote
3answers
2k 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\...
1
vote
1answer
1k views

Magento-2 How to add website_id column to my custom existing table by Upgrade Schema

I want to add website_id column to my custom table with index and foreign key by UpgradeSchema. It is easy to add by InstallSchema but I want to add website_id column by UpgradeSchema in my existing ...
1
vote
2answers
860 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 ...
1
vote
1answer
302 views

Magento 2. Update customer attribute outside Setup [Install|Upgrade]Data

I'm trying to ad a customer attribute outside a Setup Script. To be more specific inside a console command using CustomerSetupFactory::updateAttribute method. I get an error caused by DI. Argument ...
1
vote
1answer
16 views

Error Area Code is not set when Creating a virtual Product from Upgrade Schema

I'm using magento 2.2.5 , i want to make a virtual product programmatically using UpgradeSchema , but i alws got an error Upgrading data.. Area code is not set when i run bin/magento setup:upgrade ...
1
vote
2answers
39 views

How to create upgrade schema file second time

I want to create a new upgrade schema file in magento2. I already used the install schema and upgrade schema. I need to create a new upgrade schema.
1
vote
2answers
1k views

UpgradeSchema/InstallData files not working

I've the following setup: Company/Custom/etc/module.xml: <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:...
1
vote
1answer
250 views

Magento 2 : How to Create Simple Product by UpgradeSchema?

How do I create a simple product programmatically using UpgradeSchema?
1
vote
0answers
14 views

Magento 2 - Update foreign key default to null in UpgradeSchema

I created a foreign key in install schema for my custom table like this: $custom_table->addColumn( 'customer_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['nullable' =&...
1
vote
1answer
290 views

Error Add Foreign Key Using Install Schema Magento 2

<?php namespace Magneto\BookFreeLayout\Setup; use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\...
1
vote
0answers
38 views

Magento2 - how to automatically create UpgradeData, UpgradeSchema based on existing table(s)

Who knows is there any tools, modules or whatever to convert existing table dump and structure into UpgradeData, UpgradeSchema? Why? For example you created complicated settings stored in DB and you ...
1
vote
1answer
98 views

Magento 2.1.7 custom module UpgradeSchema not adding column

I'm not able to add new column to existing table UpgradeSchema.php: namespace Company\Module\Setup; use Magento\Framework\Setup\UpgradeSchemaInterface; use Magento\Framework\Setup\...
1
vote
0answers
224 views

Custom attribute not updated in Magento 2

I am new to Magento 2. We have created a custom module in Magento 2. We have successfully created a custom attribute in that module and created installdata.php file in the custom module. My problem ...
1
vote
0answers
161 views

Magento 2 : UpgradeSchema write mysql trigger

I am trying to add mysql trigger using the upgradeschema in magento 2 but I am getting the "Cannot execute multiple queries". Below is my trigger DELIMITER $$ CREATE TRIGGER ...
0
votes
2answers
149 views

Cretate new table to existing module in Magento2

I have created the module and installed. I forgot to include Setup/InstallSchema.php to create the table first time Once the module is created can we create new table using InstallSchema.php? I ...
0
votes
1answer
38 views

Error on creating UpgradeSchema.php

<?php namespace Essence\Slider\Setup; use Magento\Framework\Setup\UpgradeSchemaInterface; use Magento\Framework\Setup\SchemaSetupInterface; use Magento\Framework\Setup\...
0
votes
1answer
340 views

Modification of Magento 2 database core table

I am getting this error in UpgradeSchema. I have added one column in these core tables, functionalities are working good. According to coding standard it shows warning message. ----------------------...
0
votes
2answers
51 views

Magento 2: Update database table add new columns like created_at and updated_at from module

UpgradeScema.php <?php namespace Lucent\MegaMenu\Setup; use Magento\Framework\Setup\UpgradeSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\...
0
votes
1answer
76 views

Add foreign key on UpgradeSchema return “Foreign key constraint is incorrectly formed”?

I want to add a new attribute to catalog_product_website table named id_admin_user to make relation with admin_user table. PS: I want to do that to save the ID of the admin user who added a product. ...
0
votes
1answer
40 views

GetPrice Function Adds Zeros at the end

I'm using this code for structured data. <meta itemprop="price" content="<?php echo $_product->getPrice(); ?>"> I get the price that I need but it adds ".0000" at the end. Please ...
0
votes
1answer
324 views

UpgradeSchema not working in Magento 2.2.5?

I have make setup:upgrade with changing module version here is my code: <?php namespace Tatva\ProductImport\Setup; use Magento\Framework\Setup\UpgradeSchemaInterface; use Magento\...
0
votes
1answer
327 views

error : add foreign keys in UpgradeSchema

I am trying to give foreign keys in Upgrade Schema but it is still not working class UpgradeSchema implements UpgradeSchemaInterface { public function upgrade(SchemaSetupInterface $setup, ...
0
votes
2answers
143 views

Problem with add an attribute to Customer in magento 2

I created a module in this way: I created a vendor folder "Test1" Then I created a module folder "AddCustomerAttr" then a folder inside the module "etc" and inside "etc" I put module.xml: <?xml ...
0
votes
1answer
32 views

SchemaUpgrade issue in Magento 2

Today I'm learning Upgrading schema and Upgrading data, for this I am created simple table with version0.0.1 and it's working fine. Later I written code for UpgradeSchema. But it is not working for ...
0
votes
2answers
48 views

Update Schema for Magento 2

How do I write update schema in Magento 2 for the following: $installer->run( "UPDATE {$this->getTable('catalog_eav_attribute')} SET `is_visible` = 0 WHERE `attribute_id` IN(SELECT `...
0
votes
0answers
65 views

Upgrade schema script is not working with magento 2.1.3?

I have upgraded my magento version from 2.1.6 to 2.3.1. There is a custom module which is using upgradeschema but in magento 2.3.1. this is not working. Could anyone help me with this ?
0
votes
0answers
34 views

URL field for Google Structured Data

What is the solution to add markup for product URL or even home page url? I tried many combinations calling product url, specifying url directly... Still Google structured data tool does not recognize ...
0
votes
0answers
39 views

Facing error when upgrading schema in magento2

Installing schema... Upgrading schema... SQLSTATE[42S02]: Base table or view not found: 1146 Table 'st_m2_225_21082018.sentence_sentence' doesn't exist, query was: DESCRIBE SENTENCE_SENTENCE <?php ...
0
votes
1answer
40 views

Warning when upgrade scripts?

if (version_compare($context->getVersion(), '1.1.10', '<=')) { $installer = $setup; $installer->startSetup(); // Get tutorial_simplenews table ...
0
votes
1answer
256 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', '...
0
votes
1answer
48 views

Base Table or View not found after adding Category EAV

Ive tried to add my custom category eav attribute but after setup:upgrade and setup:di:compile I get the following error: 2 exception(s): Exception #0 (Zend_Db_Statement_Exception): SQLSTATE[42S02]: ...
0
votes
1answer
224 views

Editing in UpgradeSchema.php method does not apply after running setup:upgrade

I have written a small module and I've made Setup classes include InstallData, InstallSchema, UpgradeData, and UpgradeSchema and put them in Setup folder, For the first time I did run setup:upgrade ...
0
votes
1answer
27 views

SchemaUpdate is not executed after running setup script

I am trying to run some Setup\UpgradeSchema.php lines. I run: php bin/magento setup:upgrade And my module code is not executed. My Setup\UpgradeSchema.php looks more or less like this: if (...