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

Fixes Maria issue with 'NULL' returned instead of NULL on MariaDB 10.2.6+ #5181

Merged
merged 2 commits into from May 22, 2022

Conversation

iBotPeaches
Copy link
Contributor

Fixes: #5154


If we look at https://jira.mariadb.org/browse/MDEV-13132, a bug was fixed to properly quote default value to be able to determine expressions vs null. This meant due to the strict typing that 'NULL' was not detected as null and thus attempted to be included as a default value even against a not-nullable table here - https://github.com/knex/knex/blob/master/lib/schema/tablecompiler.js#L333

I've never worked with this project, but my Ghost blog stopped working and while Ghost is dropping Maria and I'm sad about that. I cannot complain seeing how I paid $0, so I'm attempting to fix to resolve this issue.

I added a test which I believe resolves issue, but to truly replicate you need Maria 10.2.6+ and I don't even see that in the integration suite (the docker). So while I pointed my test to my own Maria and confirmed this works as well as "monkey patching" this fix into my live environment as well. So I am setting this to draft to figure out how you recommend I solve this in terms of "proving" it was solved.

  • Should I bring in Maria into integration suite, which might expose a few more issues?
  • How should I handle this?

(proof of Ghost working after patch)

Message: Ghost was able to start, but errored during boot with: alter table `newsletters` modify  `created_at` datetime null default 'NULL' - Invalid default value for 'created_at'

Debug Information:
    OS: Ubuntu, v20.04.4 LTS
    Node Version: v14.19.2
    Ghost Version: 4.47.3
    Ghost-CLI Version: 1.18.1
    Environment: production
    Command: 'ghost restart'

Additional log info available in: xxx

connor@dune:/var/www/connor/blog$ ghost start
+ sudo systemctl start ghost_connortumbleson-com
✔ Starting Ghost

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.0003%) to 92.24% when pulling d7803a7 on iBotPeaches:issue-5154 into ad62d90 on knex:master.

@iBotPeaches iBotPeaches marked this pull request as ready for review May 17, 2022 21:46
Copy link
Collaborator

@OlivierCavadenti OlivierCavadenti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx for the PR !

@OlivierCavadenti OlivierCavadenti merged commit b20047b into knex:master May 22, 2022
@iBotPeaches iBotPeaches deleted the issue-5154 branch May 23, 2022 16:18
@gllmhyt
Copy link

gllmhyt commented May 25, 2022

Having the same issue this PR fixes, how can I apply it on my Ghost install so I can upgrade ? Thanks a lot.

@kibertoad
Copy link
Collaborator

Unfortunately, you can't. This version of knex was not released yet, but even if it was, Ghost uses bookshelf, which still does not support latest knex versions: bookshelf/bookshelf#2120

@daniellockyer
Copy link
Contributor

@kibertoad Ghost (I) just decided to run with the latest Knex anyway. It means we're ignoring the peer dependencies but Bookshelf is pretty dead and we're looking at other Knex-based ORMs anyway. I considered forking Bookshelf but what we did was the quickest route.

Once Knex is released, I can bump within Ghost

@kibertoad
Copy link
Collaborator

Got it, I'll release today then.

@kibertoad
Copy link
Collaborator

Released in 2.1.0

@daniellockyer
Copy link
Contributor

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dropNullable gives incorrect SQL on MariaDB 10.2.7+
6 participants