Assuming that field name is myfield
:
$fields['myfield'] = BaseFieldDefinition::create('<type>');
Type string
Creates 1 database column with type varchar(255)
:
+-----------------+------------------+
| Field | Type |
+-----------------+------------------+
| myfield | varchar(255) |
+-----------------+------------------+
Type string_long
Creates 1 database column with type longtext
:
+-----------------+------------------+
| Field | Type |
+-----------------+------------------+
| myfield | longtext |
+-----------------+------------------+
Type text
Creates 2 database columns:
+-----------------+------------------+
| Field | Type |
+-----------------+------------------+
| myfield__value | varchar(255) |
| myfield__format | varchar(255) |
+-----------------+------------------+
Type text_long
Creates 2 database columns:
+-----------------+------------------+
| Field | Type |
+-----------------+------------------+
| myfield__value | longtext |
| myfield__format | varchar(255) |
+-----------------+------------------+