Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ioweb-gr opened this issue Apr 12, 2020 · 1 comment · Fixed by #7045
Closed

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

ioweb-gr opened this issue Apr 12, 2020 · 1 comment · Fixed by #7045
Assignees
Projects

Comments

@ioweb-gr
Copy link

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

@m2-community-project m2-community-project bot added this to Ready for Grooming in Backlog Apr 12, 2020
@ioweb-gr ioweb-gr changed the title for text element the attribute 'length' is not allowed. for text column in db_schema the attribute 'length' is not allowed. Apr 12, 2020
atwixfirster added a commit to atwixfirster/devdocs that referenced this issue Apr 16, 2020
@m2-community-project m2-community-project bot moved this from Ready for Grooming to Pull Request In Progress in Backlog Apr 16, 2020
@atwixfirster
Copy link
Contributor

Good catch, @ioweb-gr !

When you use a TEXT type for a column you don’t have to specify a storage length like for CHAR and VARCHAR.

Fixed in #7045.

Thanks

dobooth added a commit that referenced this issue Apr 16, 2020
#7029: for text column in db_schema the attribute 'length' is not allowed.
@m2-community-project m2-community-project bot moved this from Pull Request In Progress to Done in Backlog Apr 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Backlog
  
Done
2 participants