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,', 'id int(11) unsigned NOT NULL AUTO_INCREMENT,',
'subscriber_id int(11) unsigned NOT NULL,', 'subscriber_id int(11) unsigned NOT NULL,',
'custom_field_id int(11) unsigned NOT NULL,', 'custom_field_id int(11) unsigned NOT NULL,',
'value text,', 'value text NOT NULL,',
'created_at TIMESTAMP NULL,', 'created_at TIMESTAMP NULL,',
'updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,', 'updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,',
'PRIMARY KEY (id),', 'PRIMARY KEY (id),',

View File

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