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

for text column in db_schema the attribute 'length' is not allowed. #7029

@ioweb-gr

Description

@ioweb-gr

Bug report

https://devdocs.magento.com/guides/v2.3/extension-dev-guide/declarative-schema/db-schema.html
In the docs it suggests that we can use length attribute for text column nodes however it doesn't seem to be the case as magento 2 throws an error.

Element 'column', attribute 'length': The attribute 'length' is not allowed.

Description

Currently in the docs it mentions that we can use length attribute to define the text column size however Magento 2 won't allow it failing to create the column.

e.g. from the docs


<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"                  xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd"> 
    <table name="declarative_table">
         <column xsi:type="int" name="id_column" padding="10" unsigned="true" nullable="false" comment="Entity Id"/>         
<column xsi:type="int" name="severity" padding="10" unsigned="true" nullable="false" comment="Severity code"/>
 -       <column xsi:type="varchar" name="title" nullable="false" length="255" comment="Title"/>
 +       <column xsi:type="text" name="title" nullable="false" length="255" comment="Title"/>         
<column xsi:type="timestamp" name="time_occurred" padding="10" comment="Time of event"/>         
<constraint xsi:type="primary" referenceId="PRIMARY">
             <column name="id_column"/>
         </constraint>
     </table>
 </schema>
--

Steps to reproduce

Create a db_schema.xml and define a table with a column like this
<column name="validate_rules" xsi:type="text" length="255" comment="Validate Rules" />

Expected result

Either the column is created correctly or the documentation is updated. We need a definition on how to set the size for text columns via db_schema.xml

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions