Adding a new NOT NULL field to a table causes an error
If the field spec sets 'not null' =&gt; TRUE but does not define a default value, the column is created allowing null values and later altered to disallow them (see the mysql driver Schema::addField(), and the $fixnull variable).  The second query attempting add the restriction fails, causing the error.

To fix the error, either


An 'initial' value needs to be added to the spec provided to addField()

Drupal::database()-&gt;schema()-&gt;addField(
  'MYMODULE_table',
  'created',        
  [
    'type' =&gt; 'int',
    'unsigned' =&gt; TRUE,
    'not null' =&gt; TRUE,
    'initial' =&gt; 0,
  ]
)

Or a 'default' value needs to be added to the spec provided to addField().
When providing a default value, the spec in hook_schema() should also be changed to match.