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
sql/mysql: Attempt a fix for RawExpr cases #797
Conversation
hey @ofpiyush |
Yes, I was playing with atlas and the bug just sucked me in. That commit was a lesson in why you shouldn't push code at 3 AM 😅 CURRENT_TIMESTAMP cases were failing. For now, I've added an exception for them. A better solve for this family of problems will be fairly involved. Comparing the exact query can be brittle but attempting to compare the intent(via AST) behind the query might still result in wrong query and/or lot of edge cases to handle on a case to case basis. Another such example is a field with default |
Thanks for the contribution @ofpiyush 🙏 Code looks great, but the tests in
Can you elaborate with an example? Did you address it in this PR? If not, that's fine, I can take this as well. |
@a8m Would you believe that those tests pass in go 1.17? Would be interesting to know why! I've updated the test cases.
I've opened #803 to describe the bug. I haven't attempted it mostly because I am not sure if we're missing an |
Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>
Thanks for the contribution @ofpiyush 🙏 |
This is an optimistic attempt at a fix for expressions/functions in schema. Feel free to correct and guide me towards a better solve. :)
The wrapping is somewhat redundant when we already have
sql()
but going by the comments in code, backwards compatibility has made the situation a little messy.Fixes #795
Note: Initially, MySQL looked like it was working fine without this change.
But if we tried to inspect -> drop database -> create. We ended up with string default instead of an expression.