diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/BooleanItem.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/BooleanItem.php index 2d242a4..1d9884f 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/BooleanItem.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/BooleanItem.php @@ -52,6 +52,7 @@ public static function schema(FieldDefinitionInterface $field_definition) { 'value' => array( 'type' => 'int', 'size' => 'tiny', + 'not null' => TRUE, ), ), ); diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/DateItem.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/DateItem.php index 1082af3..c1276dd 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/DateItem.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/DateItem.php @@ -52,9 +52,9 @@ public static function schema(FieldDefinitionInterface $field_definition) { return array( 'columns' => array( 'value' => array( - 'type' => 'int', - // @todo Needs a size. What kind of value do we store here anyway, a - // timestamp? + 'type' => 'varchar', + 'length' => 20, + 'not null' => FALSE, ), ), ); diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EmailItem.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EmailItem.php index b419507..aee1a4a 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EmailItem.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EmailItem.php @@ -53,6 +53,7 @@ public static function schema(FieldDefinitionInterface $field_definition) { 'value' => array( 'type' => 'varchar', 'length' => EMAIL_MAX_LENGTH, + 'not null' => FALSE, ), ), ); diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/FloatItem.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/FloatItem.php index 0ca6d0f..045af1c 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/FloatItem.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/FloatItem.php @@ -52,6 +52,7 @@ public static function schema(FieldDefinitionInterface $field_definition) { 'columns' => array( 'value' => array( 'type' => 'float', + 'not null' => FALSE, ), ), ); diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/IntegerItem.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/IntegerItem.php index 23bb1ad..ec49cdb 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/IntegerItem.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/IntegerItem.php @@ -52,6 +52,7 @@ public static function schema(FieldDefinitionInterface $field_definition) { 'columns' => array( 'value' => array( 'type' => 'int', + 'not null' => TRUE, ), ), ); diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/LanguageItem.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/LanguageItem.php index 1456b80..3bae65b 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/LanguageItem.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/LanguageItem.php @@ -65,6 +65,7 @@ public static function schema(FieldDefinitionInterface $field_definition) { 'value' => array( 'type' => 'varchar', 'length' => 12, + 'not null' => FALSE, ), ), ); diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/StringItem.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/StringItem.php index feb5bd7..ce78a40 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/StringItem.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/StringItem.php @@ -55,7 +55,8 @@ public static function schema(FieldDefinitionInterface $field_definition) { 'columns' => array( 'value' => array( 'type' => 'varchar', - 'length' => $field_definition->getFieldSetting('max_length'), + 'length' => $field_definition->getSetting('max_length'), + 'not null' => FALSE, ), ), ); diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/UriItem.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/UriItem.php index dc118a7..4cad163 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/UriItem.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/UriItem.php @@ -51,6 +51,7 @@ public static function schema(FieldDefinitionInterface $field_definition) { 'columns' => array( 'value' => array( 'type' => 'text', + 'not null' => TRUE, ), ), ); diff --git a/core/modules/field/lib/Drupal/field/Entity/Field.php b/core/modules/field/lib/Drupal/field/Entity/Field.php index c3fd8cd..e1f89e2 100644 --- a/core/modules/field/lib/Drupal/field/Entity/Field.php +++ b/core/modules/field/lib/Drupal/field/Entity/Field.php @@ -178,6 +178,13 @@ class Field extends ConfigEntityBase implements FieldInterface { public $deleted = FALSE; /** + * The field schema. + * + * @var array + */ + protected $schema; + + /** * The original field. * * @var \Drupal\field\Entity\Field diff --git a/core/modules/system/system.module b/core/modules/system/system.module index b6d4e2b..a9187b2 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -7,7 +7,6 @@ use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Cache\Cache; -use Drupal\Core\Field\Plugin\Field\FieldType\EmailItem; use Drupal\Core\Language\Language; use Drupal\Core\Utility\ModuleInfo; use Drupal\user\UserInterface; diff --git a/core/modules/text/lib/Drupal/text/Plugin/Field/FieldType/TextItem.php b/core/modules/text/lib/Drupal/text/Plugin/Field/FieldType/TextItem.php index 2fbec6c..bf415c5 100644 --- a/core/modules/text/lib/Drupal/text/Plugin/Field/FieldType/TextItem.php +++ b/core/modules/text/lib/Drupal/text/Plugin/Field/FieldType/TextItem.php @@ -36,7 +36,7 @@ public static function schema(FieldDefinitionInterface $field_definition) { 'columns' => array( 'value' => array( 'type' => 'varchar', - 'length' => $field_definition->settings['max_length'], + 'length' => $field_definition->getSetting('max_length'), 'not null' => FALSE, ), 'format' => array(