Ghost: Migration error on newsletter when upgrading past v4.46.0 [MariaDB]
Issue Summary
When I tried to upgrade my Ghost from v4.44.0 to v4.46.0 I got this error message upon launch:
Message: Ghost was able to start, but errored during boot with: alter table
newslettersmodifycreated_atdatetime null default ‘NULL’ - Invalid default value for ‘created_at’
I must add, my newsletters table has no data:
Steps to Reproduce
- Upgrade Ghost to
v4.46.0 - Launch Ghost
Ghost Version
v4.44.0
Node.js Version
v14.18
How did you install Ghost?
Local install on Linux server
Database type
Other
Browser & OS version
No response
Relevant log / error output
No response
Code of Conduct
- I agree to be friendly and polite to people in this repository
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 7
- Comments: 27 (5 by maintainers)
Thanks @daniellockyer for the explanation.
Unfortunately there are some environments where MySQL is not supported (Archlinux for example) and we have to use MariaDB. MariaDB is supposed to be a drop-in replacement of MySQL so everything should work as expected (and was working until
v4.46).I know this is not totally in your control, I just wanted to note this 😃
Hi all - this seems to be an issue with Knex and MariaDB. I’ve opened an issue, so hopefully it can be fixed soon 🙂
Just to point out, MariaDB is not an officially supported database for Ghost. It just happened to work given the similarities with MySQL, but we optimize and test for MySQL 5 and 8.
Ghost v5 will only support MySQL 8 in production, so I’d strongly suggest switching to MySQL 8 to ensure you’re running on the recommended setup.
Even more stupid was dropping PostgreSQL some time ago. It seems Ghost team is trying to get less and less people using their project. Now all of us should drop MariaDB just because Ghost is using some MySQL specific dialect.
Solely relying on Oracle’s solution (the same that thrashed OpenOffice, bribed african government officials in order to win business contracts, or made dangerous false claims of security…) despite a community-driven one is beyond me.
Update: mysql-8.0 is neither available in Debian stable repositories, nor testing repos (but in sid for now). Installing mysql-8.0 from Oracle (who I trust less than Debian packagers) break dependencies with packages relying on MariaDB 10, the default-mysql-server in Debian. So, because of a single migration, one of the biggest distros cannot be used to host a Ghost blog. This is madness.
same here !!!
Instead of pushing on solving the knex bug “default ‘NULL’” for datetime type, which is obviously wrong, ‘NULL’ is string and not the datetime type, Ghost team wants to drop MariaDB. Great guys, stick with enforcing bugs. And instead of switching to type strict TypeScript, let’s keep JS and no types in database, who cares, same sh*t. It’s probably the right time to write another blog post for a falling open source project.
Thanks, I also found the post on their forum too. Astoundingly stupid decision. I don’t even use the “newsletters” stuff. 😞
Sure seems we have a hard time keeping it related to migration bug because all the lights point in that dropping MariaDB is intentional?
Migrated to MySQL. Fortunately I’m in containers mode with Docker. Just created a temporary container with a new docker volume… Imported my saved database. Remanaged the old container (using now mysql8) to use the new docker volume. Restarted all. All goods There is now no more problems to use the last version of Ghost.
But I think it’s stupid dropping mariaDB.
Here is the full log output:
And here is the query result:
I’d just like to say…you made a comment about “non-commercial” users but…Don’t THEY know those of us TINKERING with it are who will sell it for them if it’s something we like? LOL sigh…
My comment in the announcement of Ghost 5 has been marked off-topic, why? Do you really want to intentionally make BC just to drop MariaDB? And only keep shi**y MySQL with the wrong behavior? Datetime can’t have default value of ‘NULL’, that’s string guys.
The upstream issue hasn’t been fixed yet - details in this comment: https://github.com/TryGhost/Ghost/issues/14634#issuecomment-1114989262
In the meantime, a friendly forum user has shared how he updated from MariaDB to MySQL8 on Ubuntu here: https://forum.ghost.org/t/how-to-migrate-from-mariadb-10-to-mysql-8/29575