- WIP on Migration of MsSQL

This commit is contained in:
Dave Mc Nicoll committed 2025-05-21 18:46:34 +00:00
1 parent c54de30069
commit fb4985160a
17 files changed
+252 -175

No files matched your search

+12 -3
View File
@@ -69,16 +69,19 @@ class Column
{
$nullable = $this->nullable === 'YES';
$definitionValue = $this->getDefinitionValue($definition);
if ($nullable !== $definition->allowsNull()) {
return false;
}
if ( isset($definition->value) && $this->canHaveDefaultValue() ) {
if ( $definition->value !== $this->defaultValue()) {
if ( isset($definitionValue) && $this->canHaveDefaultValue() ) {
if ( $definitionValue !== $this->defaultValue() ) {
# dump($definition->value, $this->defaultValue(), $definition->name);
return false;
}
}
elseif (! isset($definition->value)) {
elseif (! isset($definitionValue)) {
if ( ! $this->defaultValueIsNull() ) {
return false;
}
@@ -87,6 +90,12 @@ class Column
return true;
}
protected function getDefinitionValue(ReflectedProperty $definition) : mixed
{
# Attribute's value first, then defined in class value
return $definition->getAttribute(Field::class)->object->default ?? $definition->value ?? null;
}
protected function defaultValueIsNull() : bool
{
return $this->defaultValue() === null;