diff --git a/src/Database/Models/MySQL/MySQLColumn.php b/src/Database/Models/MySQL/MySQLColumn.php index 0791aa9..1e77afa 100644 --- a/src/Database/Models/MySQL/MySQLColumn.php +++ b/src/Database/Models/MySQL/MySQLColumn.php @@ -358,6 +358,12 @@ private function getMariaDBColumnDefault(?string $columnDefault): ?string }; } + /** + * Set the default value to `CURRENT_TIMESTAMP` if the value is `CURRENT_TIMESTAMP(2)`, `CURRENT_TIMESTAMP(3)`, ... `CURRENT_TIMESTAMP(n)`. + * This function is needed so that + * column type `datetime(2) DEFAULT CURRENT_TIMESTAMP(2)` would be generated as + * `dateTime('datetime', 2)->useCurrent()`. + */ private function flattenCurrentTimestamp(): void { if ($this->default === null) {