Questions tagged [db-schema]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
27 views

foreign key db_schema.xml automatic renamed to FK_ magento 2

I have this db_schema.xml <?xml version="1.0"?> <!-- /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ --> <schema xmlns:xsi=&...
0
votes
0answers
8 views

db_schema.xml : (Insert value list does not match column list) How to 'ignore' destination table columns when migrating (upgrading) tables

Question How do I configure db_schema.xml to ignore columns inside the destination table when 'upgrading/renaming' a table? Information The module has been refactored and rebuilt with a few more ...
0
votes
1answer
12 views

Magento 2 - create a table with foreign key constraint

I try to add this database table. It has a foreign key constraint to the customer_entity table. I need to configure it so if the customer is getting deleted that record is also getting deleted. This ...
1
vote
3answers
30 views

How to change table column nullable definition using declarative schema?

I have added a table using declarative schema given below: <table name="trade_item_brand_category"> <column xsi:type="int" name="id" padding="10&...
0
votes
1answer
37 views

Magento2: what is the purpose of having db_schema_whitelist.json?

I'm looking for some sort of explanation for the below topics but I'm not able to find the exact answers on the internet. What is the need for db_schema_whitelist.json? (I have read that this file ...
0
votes
1answer
30 views

How to filter products out with custom created field on catalog_product_entity

I have added 2 fields in db_schema.xml there created on table catalog_product_entity the challenges for me now are I'm using the one field as custom state and this state is the field I need to filter ...
0
votes
1answer
85 views

Adding a new auto-increment field to the table `salesrule_coupon_usage` table returns a SQL error on setup:upgrade step

In my custom module (tested on Magento CE 2.4.2-p1) feature of tracking the Sales Coupon usages sometimes have no info about Customer ID, and it is acceptable case. So I need to change table ...
0
votes
0answers
24 views

Is it possible to handle db_schema.xml differently for different versions of Magento

Is there a way to handle version or use different db_schema.xml for different version of magento? The issue is that setup:upgrade will require foreign key constraints to match exactly. But how do you ...
0
votes
1answer
22 views

How to update Magento core column from type int to decimal using declarative schema?

I want to update the core table column from type int to decimal. <column xsi:type="int" name="column_name" padding="10" unsigned="true" nullable="false&...
2
votes
1answer
340 views

Magento 2.4 Error: The attribute 'length' is not allowed

I want to change the field type of catalogrule_product table from varchar to text. <column xsi:type="varchar" name="action_operator" nullable="true" length="10&...
-1
votes
1answer
23 views

Change type of field in db (table: quote, field: customer_note, current type: varchar, wanted type: text)

I try to change the type of the field customer_note in the quote table from varchar to text. I went the declarative way: VendorName/Module/etc/db_schema.xml: <?xml version="1.0" ?> <...
0
votes
1answer
21 views

Unable to create table with foreign key?

<table name="profile_products" resource="default" engine="innodb" comment="profile products"> <column xsi:type="smallint" ...
0
votes
2answers
457 views

Magento 2 how to increase text type field length?

I have a module where I save a PDF file in a text type field, however I just realized that the pdf was not stored completly, it misses some characters. This is how I created the field: $installer->...
0
votes
1answer
28 views

Base DB schema didn't create table

In my report_sales > coupons page I get exception Base table or view not found: 1146 Table salesrule_coupon_aggregated doesn't exist And I find out that system didn't create this table (It doesn't ...
0
votes
1answer
32 views

How to add created at and updated at column and update it on values save?

I want to add created_at and updated_at columns in a custom table and update both columns on saving the data.
0
votes
2answers
1k views

Auto increment in db_schema.xml

In M2 dev docs there is this regarding auto increment: identity Indicates whether a column is auto incremented. Here's excerpt from my db_schema.xml: <column xsi:type="int" name="entity_id" ...
0
votes
0answers
150 views

Can't create unique and fulltext index on the same column

My table in db_schema looks like below. <table name="test"> <column xsi:type="int" identity="true" name="test_id" padding="10" unsigned="true" nullable="false" comment="Entity Id"/> ...
0
votes
2answers
5k views

How to create table and field using db_schema.xml in magento 2

I want to create table and fields using db_schema.xml rather than InstallSchema in custom module. Can anyone help please?
0
votes
1answer
91 views

Allow tinytext in db_schema.xml magento 2

I'm doing a custom migration from Magento 1.9 to Magento 2.3.4 , in one of the custom module on Magento 1.9 it uses tinytext as table column type, therefore I tried to recreate this module using ...
1
vote
2answers
208 views

Magento2.3 - What is the benefit of Declarative DB Schema over Traditional installation schema for DB management?

At the Magento Imagine Conference, Magento announced the next noteworthy release on the Magento platform – Magento 2.3. It has enormous features, back-end enhancements, and optimizations. So I just ...
0
votes
2answers
1k views

Created at and Updated at columns using db schema xml - Magento 2

I have a custom table. Using the InstallSchema, I was able to add default values using: )->addColumn( 'created_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, ['...
2
votes
3answers
2k views

add custom attribute for customer in magento 2.3 using db schema

how I can add a custom attribute for customer using DB schema in Magento 2.3 does anyone is already tried Just help me?