-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TIMESTAMP type mixed with DATETIME #6741
Comments
I found something in documentation that might point to solving this problem:
But how can I manipulate said version to get the type I need? |
It seems that the information is lost - not good at all.
Column has type I tried to add this snippet before the return in
// when using this override for timestamp SQL generator preserves TIMESTAMP
if ('timestamp' === $dbType) {
$column->setPlatformOption('version', true);
} // my code
$table = $manager->introspectSchema()->getTable($tableName);
$createSql = $this->platform()->getCreateTableSQL($table);
// returns
// time_created DATETIME DEFAULT 'current_timestamp(6)' NOT NULL, Table in MariaDB has
|
Assigning true to column's platform options version does something right, but only to extent. It's still missing precision value, in this case 6. Looks like something regarding this was done in #5961, but never got the chance to be merged... |
Bug Report
Summary
When performing SchemaDiff between two schemas and then generating SQL statements that will represent the same schema diff performed, type TIMESTAMP(N) is replaced with DATETIME.
Current behavior
The current behavior is that the migrating SQL statement determines the wrong type of the column. I have a type
timestamp(6)
and the default value for this columncurrent_timestamp(6)
. When executing the following code:In the
alterSchemaSQL
there is a query that looks like (I omitted unrelevant columns):The query won't even execute.
Expected behavior
It executes if I remove
'
aroundcurrent_timestamp(6)
, but then the default value turns to be justcurrent_timestamp()
. Only when I rewrite the query as:It executes and the table has all columns with expected properties.
How to reproduce
The code I'm executing:
The text was updated successfully, but these errors were encountered: