Skip to content
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

Clarify CURRENT_TIMESTAMP support across MySQL versions #710

Closed
tomhoule opened this issue Apr 23, 2020 · 4 comments · Fixed by #819
Closed

Clarify CURRENT_TIMESTAMP support across MySQL versions #710

tomhoule opened this issue Apr 23, 2020 · 4 comments · Fixed by #819
Assignees
Labels
tech/engines/migration engine Issue in the Migration Engine tech/engines Issue for tech Engines.
Milestone

Comments

@tomhoule
Copy link
Contributor

tomhoule commented Apr 23, 2020

@tomhoule tomhoule added the tech/engines/migration engine Issue in the Migration Engine label Apr 23, 2020
@tomhoule tomhoule added this to the Beta Backlog milestone Apr 23, 2020
@tomhoule tomhoule self-assigned this Apr 23, 2020
@radicand
Copy link

radicand commented May 8, 2020

@tomhoule , I provided information in the other tickets, but the core issue is that the current syntax used to change the default on pre-existing datetime fields to add current_timestamp is invalid. This is a hard blocker for any project migrating via introspect and needing to add support for functions like createdAt. At the moment, I'm fully stalled on a project until the syntax is corrected. Notes here: prisma/migrate#429 (comment)

@janpio janpio removed this from the Beta Backlog milestone May 11, 2020
@janpio janpio added this to the 2.1.0 milestone Jun 11, 2020
@chanlito
Copy link

@radicand I'm stuck just like you. Have you found a workaround?

@radicand
Copy link

@radicand I'm stuck just like you. Have you found a workaround?

It's not ideal at all, but when I need to execute a migration I truncate the Migrations table, delete all previous migration files, create a new 'initial' migration, and then manually edit steps.json to remove all the blocks associated with setting the default now() column (two blocks in the file per column affected). Running the migration after should succeed, but you have to repeat all these steps every time you have a new change.

@janpio janpio added tech/engines Issue for tech Engines. and removed process/candidate labels Jun 11, 2020
@tomhoule
Copy link
Contributor Author

This is something we are planning to address very soon. The reason it takes time is because SET DEFAULT CURRENT_TIMESTAMP doesn't work on most mysql versions, so we have to change our approach to migrating defaults to use MODIFY, which isn't trivial as we need to know the exact column definition to repeat it with a different default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tech/engines/migration engine Issue in the Migration Engine tech/engines Issue for tech Engines.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants