Skip to content

Commit

Permalink
Add comment to flattenCurrentTimestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
kitloong authored Nov 4, 2024
1 parent 3d036e3 commit e610e71
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Database/Models/MySQL/MySQLColumn.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit e610e71

Please sign in to comment.