diff options
Diffstat (limited to 'lib/private/DB/MigrationService.php')
-rw-r--r-- | lib/private/DB/MigrationService.php | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/private/DB/MigrationService.php b/lib/private/DB/MigrationService.php index 852ee8b701f..4957706bb1d 100644 --- a/lib/private/DB/MigrationService.php +++ b/lib/private/DB/MigrationService.php @@ -562,6 +562,7 @@ class MigrationService { * Data constraints: * - Columns with "NotNull" can not have empty string as default value * - Columns with "NotNull" can not have number 0 as default value + * - Columns with type "bool" (which is in fact integer of length 1) can not be "NotNull" as it can not store 0/false * * @param Schema $sourceSchema * @param Schema $targetSchema @@ -590,6 +591,10 @@ class MigrationService { && $sourceTable instanceof Table && !$sourceTable->hasColumn($thing->getName())) { throw new \InvalidArgumentException('Column "' . $table->getName() . '"."' . $thing->getName() . '" is NotNull, but has empty string or null as default.'); } + + if ($thing->getNotnull() && $thing->getType()->getName() === Types::BOOLEAN) { + throw new \InvalidArgumentException('Column "' . $table->getName() . '"."' . $thing->getName() . '" is type Bool and also NotNull, so it can not store "false".'); + } } foreach ($table->getIndexes() as $thing) { |