Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit bbfef9c

Browse files
authored
Merge pull request #2572 from magento-commerce/imported-mage2pratik-devdocs-9179
[Import] Remove padding attribute from declarative schema
2 parents 3bcac66 + f9c3691 commit bbfef9c

File tree

1 file changed

+36
-36
lines changed
  • src/guides/v2.4/extension-dev-guide/declarative-schema

1 file changed

+36
-36
lines changed

src/guides/v2.4/extension-dev-guide/declarative-schema/db-schema.md

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ The following example, extracted from the `Catalog/etc/db_schema.xml` file, defi
2323
```xml
2424
<table name="catalog_product_entity_datetime" resource="default" engine="innodb"
2525
comment="Catalog Product Datetime Attribute Backend Table">
26-
<column xsi:type="int" name="value_id" padding="11" unsigned="false" nullable="false" identity="true" comment="Value ID"/>
27-
<column xsi:type="smallint" name="attribute_id" padding="5" unsigned="true" nullable="false" identity="false" default="0" comment="Attribute ID"/>
28-
<column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="false" identity="false" default="0" comment="Store ID"/>
29-
<column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false" default="0" comment="Entity ID"/>
26+
<column xsi:type="int" name="value_id" unsigned="false" nullable="false" identity="true" comment="Value ID"/>
27+
<column xsi:type="smallint" name="attribute_id" unsigned="true" nullable="false" identity="false" default="0" comment="Attribute ID"/>
28+
<column xsi:type="smallint" name="store_id" unsigned="true" nullable="false" identity="false" default="0" comment="Store ID"/>
29+
<column xsi:type="int" name="entity_id" unsigned="true" nullable="false" identity="false" default="0" comment="Entity ID"/>
3030
<column xsi:type="datetime" name="value" on_update="false" nullable="true" comment="Value"/>
3131
<constraint xsi:type="primary" referenceId="PRIMARY">
3232
<column name="value_id"/>
@@ -160,7 +160,7 @@ For more information about each type, refer to the annotations in the correspond
160160
Example:
161161

162162
```xml
163-
<column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="true" comment="Credit ID"/>
163+
<column xsi:type="int" name="entity_id" unsigned="true" nullable="false" identity="true" comment="Credit ID"/>
164164
```
165165

166166
#### `constraint` subnode
@@ -230,10 +230,10 @@ The following example creates the `declarative_table` table with four columns. T
230230
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
231231
xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
232232
+ <table name="declarative_table">
233-
+ <column xsi:type="int" name="id_column" padding="10" unsigned="true" nullable="false" comment="Entity Id"/>
234-
+ <column xsi:type="int" name="severity" padding="10" unsigned="true" nullable="false" comment="Severity code"/>
233+
+ <column xsi:type="int" name="id_column" unsigned="true" nullable="false" comment="Entity Id"/>
234+
+ <column xsi:type="int" name="severity" unsigned="true" nullable="false" comment="Severity code"/>
235235
+ <column xsi:type="varchar" name="title" nullable="false" length="255" comment="Title"/>
236-
+ <column xsi:type="timestamp" name="time_occurred" padding="10" comment="Time of event"/>
236+
+ <column xsi:type="timestamp" name="time_occurred" comment="Time of event"/>
237237
+ <constraint xsi:type="primary" referenceId="PRIMARY">
238238
+ <column name="id_column"/>
239239
+ </constraint>
@@ -252,10 +252,10 @@ In the following example, the `declarative_table` table was completely removed f
252252
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
253253
xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
254254
- <table name="declarative_table">
255-
- <column xsi:type="int" name="id_column" padding="10" unsigned="true" nullable="false" comment="Entity Id"/>
256-
- <column xsi:type="int" name="severity" padding="10" unsigned="true" nullable="false" comment="Severity code"/>
255+
- <column xsi:type="int" name="id_column" unsigned="true" nullable="false" comment="Entity Id"/>
256+
- <column xsi:type="int" name="severity" unsigned="true" nullable="false" comment="Severity code"/>
257257
- <column xsi:type="varchar" name="title" nullable="false" length="255" comment="Title"/>
258-
- <column xsi:type="timestamp" name="time_occurred" padding="10" comment="Time of event"/>
258+
- <column xsi:type="timestamp" name="time_occurred" comment="Time of event"/>
259259
- <constraint xsi:type="primary" referenceId="PRIMARY">
260260
- <column name="id_column"/>
261261
- </constraint>
@@ -285,10 +285,10 @@ This declarative process of renaming a table is not fast. If you need to migrate
285285
xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
286286
+ <table name="new_declarative_table" onCreate="migrateDataFromAnotherTable(declarative_table)">
287287
- <table name="declarative_table">
288-
<column xsi:type="int" name="id_column" padding="10" unsigned="true" nullable="false" comment="Entity Id"/>
289-
<column xsi:type="int" name="severity" padding="10" unsigned="true" nullable="false" comment="Severity code"/>
288+
<column xsi:type="int" name="id_column" unsigned="true" nullable="false" comment="Entity Id"/>
289+
<column xsi:type="int" name="severity" unsigned="true" nullable="false" comment="Severity code"/>
290290
<column xsi:type="varchar" name="title" nullable="false" length="255" comment="Title"/>
291-
<column xsi:type="timestamp" name="time_occurred" padding="10" comment="Time of event"/>
291+
<column xsi:type="timestamp" name="time_occurred" comment="Time of event"/>
292292
<constraint xsi:type="primary" referenceId="PRIMARY">
293293
<column name="id_column"/>
294294
</constraint>
@@ -307,11 +307,11 @@ The following example adds the `date_closed` column.
307307
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
308308
xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
309309
<table name="declarative_table">
310-
<column xsi:type="int" name="id_column" padding="10" unsigned="true" nullable="false" comment="Entity Id"/>
311-
<column xsi:type="int" name="severity" padding="10" unsigned="true" nullable="false" comment="Severity code"/>
310+
<column xsi:type="int" name="id_column" unsigned="true" nullable="false" comment="Entity Id"/>
311+
<column xsi:type="int" name="severity" unsigned="true" nullable="false" comment="Severity code"/>
312312
<column xsi:type="varchar" name="title" nullable="false" length="255" comment="Title"/>
313-
<column xsi:type="timestamp" name="time_occurred" padding="10" comment="Time of event"/>
314-
+ <column xsi:type="timestamp" name="date_closed" padding="10" comment="Time of event"/>
313+
<column xsi:type="timestamp" name="time_occurred" comment="Time of event"/>
314+
+ <column xsi:type="timestamp" name="date_closed" comment="Time of event"/>
315315
<constraint xsi:type="primary" referenceId="PRIMARY">
316316
<column name="id_column"/>
317317
</constraint>
@@ -330,11 +330,11 @@ The following example removes the `date_closed` column by deleting its `column`
330330
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
331331
xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
332332
<table name="declarative_table">
333-
<column xsi:type="int" name="id_column" padding="10" unsigned="true" nullable="false" comment="Entity Id"/>
334-
<column xsi:type="int" name="severity" padding="10" unsigned="true" nullable="false" comment="Severity code"/>
333+
<column xsi:type="int" name="id_column" unsigned="true" nullable="false" comment="Entity Id"/>
334+
<column xsi:type="int" name="severity" unsigned="true" nullable="false" comment="Severity code"/>
335335
<column xsi:type="varchar" name="title" nullable="false" length="255" comment="Title"/>
336-
<column xsi:type="timestamp" name="time_occurred" padding="10" comment="Time of event"/>
337-
- <column xsi:type="timestamp" name="date_closed" padding="10" comment="Time of event"/>
336+
<column xsi:type="timestamp" name="time_occurred" comment="Time of event"/>
337+
- <column xsi:type="timestamp" name="date_closed" comment="Time of event"/>
338338
<constraint xsi:type="primary" referenceId="PRIMARY">
339339
<column name="id_column"/>
340340
</constraint>
@@ -353,11 +353,11 @@ The following example changes the `type` of the `title` column from `varchar` to
353353
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
354354
xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
355355
<table name="declarative_table">
356-
<column xsi:type="int" name="id_column" padding="10" unsigned="true" nullable="false" comment="Entity Id"/>
357-
<column xsi:type="int" name="severity" padding="10" unsigned="true" nullable="false" comment="Severity code"/>
356+
<column xsi:type="int" name="id_column" unsigned="true" nullable="false" comment="Entity Id"/>
357+
<column xsi:type="int" name="severity" unsigned="true" nullable="false" comment="Severity code"/>
358358
- <column xsi:type="varchar" name="title" nullable="false" length="255" comment="Title"/>
359359
+ <column xsi:type="text" name="title" nullable="false" comment="Title"/>
360-
<column xsi:type="timestamp" name="time_occurred" padding="10" comment="Time of event"/>
360+
<column xsi:type="timestamp" name="time_occurred" comment="Time of event"/>
361361
<constraint xsi:type="primary" referenceId="PRIMARY">
362362
<column name="id_column"/>
363363
</constraint>
@@ -384,10 +384,10 @@ The following example adds the `INDEX_SEVERITY` index to the `declarative_table`
384384
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
385385
xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
386386
<table name="declarative_table">
387-
<column xsi:type="int" name="id_column" padding="10" unsigned="true" nullable="false" comment="Entity Id"/>
388-
<column xsi:type="int" name="severity" padding="10" unsigned="true" nullable="false" comment="Severity code"/>
387+
<column xsi:type="int" name="id_column" unsigned="true" nullable="false" comment="Entity Id"/>
388+
<column xsi:type="int" name="severity" unsigned="true" nullable="false" comment="Severity code"/>
389389
<column xsi:type="text" name="title" nullable="false" length="255" comment="Title"/>
390-
<column xsi:type="timestamp" name="time_occurred" padding="10" comment="Time of event"/>
390+
<column xsi:type="timestamp" name="time_occurred" comment="Time of event"/>
391391
<constraint xsi:type="primary" referenceId="PRIMARY">
392392
<column name="id_column"/>
393393
</constraint>
@@ -405,10 +405,10 @@ In the following example, the selected `constraint` node defines the characteris
405405
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
406406
xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
407407
<table name="declarative_table">
408-
<column xsi:type="int" name="id_column" padding="10" unsigned="true" nullable="false" comment="Entity Id"/>
409-
<column xsi:type="int" name="severity" padding="10" unsigned="true" nullable="false" comment="Severity code"/>
408+
<column xsi:type="int" name="id_column" unsigned="true" nullable="false" comment="Entity Id"/>
409+
<column xsi:type="int" name="severity" unsigned="true" nullable="false" comment="Severity code"/>
410410
<column xsi:type="varchar" name="title" nullable="false" length="255" comment="Title"/>
411-
<column xsi:type="timestamp" name="time_occurred" padding="10" comment="Time of event"/>
411+
<column xsi:type="timestamp" name="time_occurred" comment="Time of event"/>
412412
<constraint xsi:type="primary" referenceId="PRIMARY">
413413
<column name="id_column"/>
414414
</constraint>
@@ -430,10 +430,10 @@ The following example removes the `FL_ALLOWED_SEVERITIES` foreign key by deleti
430430
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
431431
xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
432432
<table name="declarative_table">
433-
<column xsi:type="int" name="id_column" padding="10" unsigned="true" nullable="false" comment="Entity Id"/>
434-
<column xsi:type="int" name="severity" padding="10" unsigned="true" nullable="false" comment="Severity code"/>
433+
<column xsi:type="int" name="id_column" unsigned="true" nullable="false" comment="Entity Id"/>
434+
<column xsi:type="int" name="severity" unsigned="true" nullable="false" comment="Severity code"/>
435435
<column xsi:type="varchar" name="title" nullable="false" length="255" comment="Title"/>
436-
<column xsi:type="timestamp" name="time_occurred" padding="10" comment="Time of event"/>
436+
<column xsi:type="timestamp" name="time_occurred" comment="Time of event"/>
437437
<constraint xsi:type="primary" referenceId="PRIMARY">
438438
<column name="id_column"/>
439439
</constraint>
@@ -458,7 +458,7 @@ Module B disables the original primary key and sets a new primary key with a `re
458458
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
459459
xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
460460
<table name="declarative_table">
461-
<column xsi:type="int" name="id_column" padding="10" unsigned="true" nullable="false" comment="Entity Id"/>
461+
<column xsi:type="int" name="id_column" unsigned="true" nullable="false" comment="Entity Id"/>
462462
<constraint xsi:type="primary" referenceId="PRIMARY">
463463
<column name="id_column"/>
464464
</constraint>
@@ -472,7 +472,7 @@ Module B disables the original primary key and sets a new primary key with a `re
472472
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
473473
xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
474474
<table name="declarative_table">
475-
<column xsi:type="int" name="new_id_column" padding="10" unsigned="true" nullable="false"
475+
<column xsi:type="int" name="new_id_column" unsigned="true" nullable="false"
476476
comment="New Entity Id"/>
477477
<constraint xsi:type="primary" referenceId="PRIMARY" disabled="true"/>
478478
<constraint xsi:type="primary" referenceId="NEW_PRIMARY">

0 commit comments

Comments
 (0)