Questions tagged [declarative-schema]

Declarative setup is based on database structure declarations, and is used in projects such as Doctrine. Schema files declare what the database structure should be, and Magento determines the differences between the current table structure and what it should be. These differences can be represented with atomic SQL operations.

Filter by
Sorted by
Tagged with
0
votes
0answers
21 views

How to create a custom table in Magento 2.3 using XML (Declarative Schema) and integrate in custom admin grid?

I need to create an admin grid and for that i need to create a custom table using Declarative Schema in Magento 2.3. How to create a custom table using declarative schema and integrate the table with ...
0
votes
0answers
22 views

How to validate declarative schema

In Firstname i don't want to insert special character and in email only insert valid email id <table name="feedback" resource="default" engine="innodb" comment="mage2 tv example brand table" ...
1
vote
0answers
33 views

Magento 2.3 - Add a new column after one column into the table using db schema

I need to add a new column after one of the particular columns in the existing table using DB schema & checked this dev doc link, they didn't mention about the before or after column. Is there ...
0
votes
1answer
90 views

Magento 2.3 : Remove Constraint from db_schema.xml file

I just try to override db_schema.xml file of a core customer module into my custom module , but there is no success. I need to remove a constraint defined in customer db_schema.xml file, how may I do ...
1
vote
2answers
48 views

How to use magento declarative schema?

How to create table,alter table and drop the table using declarative schema?? If anyone have reference links or extension then please guide me. I already referred below links. inchoo Blog ...
0
votes
1answer
70 views

Renaming identity column with declarative schema leads to SQL error

I have the following db_schema.xml: <?xml version="1.0"?> <schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/...
4
votes
0answers
180 views

setup:db:status still reports “Declarative Schema is not up to date” after update

Since an update to Magento 2.3 I am experiencing the following issue: bin/magento setup:db:status Declarative Schema is not up to date Run setup:upgrade to update your DB schema and data. Although ...
2
votes
2answers
137 views

How to change eav_attribute table's note column's datatype varchar to mediumtext using declarative schema?

I have follow this documnet https://devdocs.magento.com/guides/v2.3/extension-dev-guide/declarative-schema/db-schema.html but not get success module.xml <?xml version="1.0"?> &...
2
votes
1answer
78 views

How to rename third-party table from our module in Declarative Schema in Magento 2.3.0?

I wanted to rename table ThirdParty to NewTable So I wrote the following code: <?xml version="1.0" ?> <schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
0
votes
2answers
319 views

Magento 2.3.1 : Add addition column in sales_order table using db_schema

How to add addition column in sales_order table using db_schema or in Magento2.3.1 best way?
1
vote
3answers
118 views

Magento 2.3.2: How to delete custom table column

I have created Custom Table Using below code. Table has been created successfully with columns. <?xml version="1.0"?> <schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ...
1
vote
1answer
33 views

Magento 2: Can we create a product attribute without patch with the declarative schema?

I want to create a product attribute without patch with the declarative schema. Example would be more descriptive.
2
votes
1answer
283 views

How to convert install/upgrade schema scripts to db_schema.xml files?

I'm following the guide from Magento DevDocs about the Declarative Schema I created a new module with old setup way (InstallSchema.php, InstallData.php) to test the convert install/upgrade schema ...
2
votes
1answer
575 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:...
0
votes
1answer
265 views

Magento 2. Declarative Schema. How to uninstall a patch without uninstalling the module?

The official docs say this. Revertable data patch - A patch that can be reverted as a module or patch is uninstalled or deleted. I know that Revertable patches must implement Magento\Framework\...
3
votes
1answer
45 views

Magento 2. Declarative schema. What is the use of the memory engine?

When creating tables using the Declarative Schema one can set the engine="" attribute value as memory. I can't seem to find an example in the core. What is a use-case for this configuration, how does ...
0
votes
0answers
86 views

Declarative schema: Incorrect Foreign Key Diff

We created a new table using M2's declarative scheme like this: <schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/...
7
votes
2answers
719 views

setup:upgrade SQL error after update from 2.2.8 to 2.3.1

What could be the reason for this error on bin/magento setup:upgrade after updating from 2.2.8 to 2.3.1? SQLSTATE[42000]: Syntax error or access violation: 1061 Duplicate key name '...
0
votes
1answer
197 views

Magento 2.3 - How add new column/field to sales_shipment table

I need to add a new column/field (total_volume) to sales_shipment table. I know that I can use two approaches to do this, but what is the best? The first approach is to use the "Extension Attributes"....
2
votes
3answers
563 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="...
1
vote
2answers
471 views

When updating to Magento 2.3.1 db_schema.xml is invalid: Element 'schema': No matching global declaration available for the validation root

While updating Magento 2.2.8 to 2.3.1 I'm facing issue when running bin/magento setup:upgrade I get error: The XML in file "/var/www/html/vendor/magento/module-store/etc/db_schema.xml" is invalid:...
0
votes
2answers
200 views

Migrate to declarative schema

people. I'm trying to migrate to declarative schema on my module with magento v2.3.1. But when i'm running php bin/magento setup:install --convert-old-scripts=1 it doesn't generates any db_schema.xml. ...
0
votes
1answer
45 views

Declarative schema approach to make customer's lastname optional

With pre-2.3 Magento versions we were able to write UpgradeData code and make customer's lastname optional as mentioned here: Magento 2 : How to make “lastname ” optional in customer registration form?...
6
votes
2answers
276 views

Empty Collection :: CollectionFactory Approach and getCollection approach both give empty result

Magento 2.3.1 Php7.2 Ubuntu 18.04 I have created a table in my database using db_schema.xml and then populated that table with sql insert commands directly in mysql workbench. My model code is &...
0
votes
0answers
66 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 ?
2
votes
2answers
59 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
3answers
2k views

Magento 2.3 - How to add custom column to customer_entity table

I'm creating a Referral Program module, and I want to create a custom column inside the customer_entity table. The column is referred_by and it's a foreign key that as a relation with the ...
2
votes
1answer
375 views

Drop column on declarative schema not working as expected

I was playing on Magento 2.3 with Declarative Schema, and everything works very well when I added a new column do db_schema.xml and did a setup:upgrade. However, when removing a column node from XML ...
2
votes
1answer
61 views

Add new Order Statuses to Magento 2.3 using declarative scheme approach

I need to add several order statuses. Could not found info how to implement it via Data Patches
3
votes
1answer
2k views

Magento 2.3 : How to create product attribute via declarative schema?

How to create a product attribute in Magento 2.3 via declarative schema. I have tried below code but the input element is not visible on the form. <?php namespace Rokanthemes\Updates\Setup\Patch\...
1
vote
1answer
127 views

Magento 2.3 - Need detail about some newly introduced feature

I need to know about some of the newly introduced featured of Magento 2.3 GraphQL Declarative DB Schema Asynchronous and Bulk Web API There are few blogs information but not elaborating properly. I ...
8
votes
2answers
2k views

Magento 2.3 use of `db_schema_whitelist.json` file in etc directory of each module

What is the use of db_schema_whitelist.json located in Magento Catalog etc directory? In Magento 2.3 version, I found db_schema_whitelist.json and db_schema.xml files, in the Magento_Catalog module. ...
4
votes
0answers
89 views

Uninstalling extension

Up to versions 2.2 (including it) you could uninstall modules installed via composer and when you did that the method uninstall from Setup/Uninstall.php will be executed. Basically this was the place ...