Add due_at column for modules that don't have the due date field when migrating records to the document table

This commit is contained in:
Burak Çakırel 2021-01-13 18:33:08 +03:00
parent 8405eb91c3
commit 0dac7fad74
No known key found for this signature in database
GPG Key ID: 48FFBB7771B99C7C

View File

@ -266,10 +266,6 @@ class Version210 extends Listener
return true;
}
if ($value === 'due_at' && in_array($table, ['estimates', 'credit_notes', 'debit_notes'])) {
return true;
}
if ($value === 'parent_id' && in_array($table, ['estimates', 'credit_notes', 'debit_notes'])) {
return true;
}
@ -306,6 +302,19 @@ class Version210 extends Listener
}
}
// due_at column should not be null so we need fill it for the modules that don't have due_at column.
if ($column === 'due_at') {
switch ($type) {
case self::ESTIMATE_TYPE:
return 'estimated_at';
case self::DEBIT_NOTE_TYPE:
case self::CREDIT_NOTE_TYPE:
return 'issued_at';
default:
return $column;
}
}
return $column;
});