Magento – Magento2.3 – How to set text column table value default is None using declarative schema

databasedeclarative-schemamagento2magento2.3

I want to create a custom table using db_schema.xml like that contains column like this:

enter image description here
enter image description here

I tried to do it like this:

<column name="description" nullable="false" default="null" xsi:type="text"/>

but always got an error like this:

The XML in file "/var/www/M2/app/code/Vendor/Module/etc/db_schema.xml" is invalid:
Element 'column', attribute 'default': The attribute 'default' is not allowed.

Best Answer

I think the problem is nullable="false" your setting the column should not be null and you are setting its default value to null, so, here you are creating a conflict for an interpreter I guess. Try the below code and let us know the result.

<column xsi:type="text" name="description" nullable="true" default="NULL" comment="Description"/>
Related Topic