if ((!$sourceTable instanceof Table || !$sourceTable->hasColumn($thing->getName())) && $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".');
}
+
+ if ($thing->getLength() > 4000 && $thing->getType()->getName() === Types::STRING) {
+ throw new \InvalidArgumentException('Column "' . $table->getName() . '"."' . $thing->getName() . '" is type String, but exceeding the 4.000 length limit.');
+ }
}
foreach ($table->getIndexes() as $thing) {
self::invokePrivate($this->migrationService, 'ensureOracleConstraints', [$sourceSchema, $schema, 3]);
}
+
+
+ public function testEnsureOracleConstraintsStringLength4000() {
+ $this->expectException(\InvalidArgumentException::class);
+
+ $column = $this->createMock(Column::class);
+ $column->expects($this->any())
+ ->method('getName')
+ ->willReturn('aaaa');
+ $column->expects($this->any())
+ ->method('getType')
+ ->willReturn(Type::getType('string'));
+ $column->expects($this->any())
+ ->method('getLength')
+ ->willReturn(4001);
+
+ $table = $this->createMock(Table::class);
+ $table->expects($this->any())
+ ->method('getName')
+ ->willReturn(\str_repeat('a', 30));
+
+ $table->expects($this->once())
+ ->method('getColumns')
+ ->willReturn([$column]);
+
+ $schema = $this->createMock(Schema::class);
+ $schema->expects($this->once())
+ ->method('getTables')
+ ->willReturn([$table]);
+
+ $sourceSchema = $this->createMock(Schema::class);
+ $sourceSchema->expects($this->any())
+ ->method('getTable')
+ ->willThrowException(new SchemaException());
+ $sourceSchema->expects($this->any())
+ ->method('hasSequence')
+ ->willReturn(false);
+
+ self::invokePrivate($this->migrationService, 'ensureOracleConstraints', [$sourceSchema, $schema, 3]);
+ }
}