Add NOT NULL constraint to custom field value field type

This commit is contained in:
Tautvidas Sipavičius
2018-05-15 11:33:22 +03:00
parent 1d8e8e8786
commit 3e9d7fc68d
2 changed files with 3 additions and 2 deletions

View File

@@ -200,7 +200,7 @@ class Migrator {
'id int(11) unsigned NOT NULL AUTO_INCREMENT,',
'subscriber_id int(11) unsigned NOT NULL,',
'custom_field_id int(11) unsigned NOT NULL,',
'value text,',
'value text NOT NULL,',
'created_at TIMESTAMP NULL,',
'updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,',
'PRIMARY KEY (id),',

View File

@@ -827,6 +827,7 @@ class SubscriberTest extends \MailPoetTest {
$subscriber_custom_field->subscriber_id = ($custom_field !== 5) ?
$subscriber->id :
100; // create one record with a nonexistent subscriber id
$subscriber_custom_field->value = 'somevalue';
$subscriber_custom_field->save();
}
expect(SubscriberCustomField::findMany())->count(5);