4 ms·
I really wish WordPress supported using SQLite as it's database instead of MySQL as this could make backups as simple as rsync'ing from prod server to backups.
by mikece 4y ago
I really wish WordPress supported using SQLite as it's database instead of MySQL as this could make backups as simple as rsync'ing from prod server to backups.
- lazide 4y agoWouldn’t you run the (real) risk of a corrupted backup?
- edbaskerville 4y agoYeah. SQLite's backup API is the right way to do this: https://sqlite.org/backup.html https://sqlite.org/backup.html
- ElectricalUnion 4y agoAnd, if you can't use the backup API for some reason, try VACUUM INTO: https://www.sqlite.org/lang_vacuum.html#vacuum_with_an_into_clause https://www.sqlite.org/lang_vacuum.html#vacuum_with_an_into_...
- mwcampbell 4y agoWould creating a ZFS snapshot, then either copying from that snapshot or sending it to another machine with zfs send, also be reliable? IIUC, ZFS snapshots are point-in-time consistent.
- Tostino 4y agoBeat me to mentioning this. Rsync is not a safe database backup tool. Period. It can be used to move around backups created by whatever specific database tool generated them, but just blindly using rsync is a recipe for unrecoverable corruption
- forgotpwd16 4y agoNot only SQLite. I would've expected WordPress be database agnostic.
- eddieroger 4y agoWhy? WordPress is from an era of PHP where the ties between PHP and MySQL were tighter than tight. What reason would they have to change away from that? I would love if WP worked with more than just MySQL as well, but I understand why it doesn't.
- forgotpwd16 4y agoIt being from an era doesn't mean it has to remain in that era. I also understand why it doesn't. I'm saying it isn't expected to (anymore).
- forinti 4y agoIt would be great to have the option to move easily between databases. SQLite would be best for development, testing, and small sites. MySQL would be better for production . And SQLite would be be great for archiving old sites.
- herbst 4y agoTo be fair exporting and importing databases is a simple command on MySQL (or postgres) so it's just a command more simple than just rsyncing the sqlite file.
- evanelias 4y agoWordPress became popular at a time when LAMP hosting was easy, widespread, and affordable. It's one reason WordPress largely supplanted Movable Type, which was an early popular blogging platform / CMS / static site generator. Because Movable Type was Perl-based, it was more difficult to host. Internally, Movable Type had a really nice object persistence / ORM abstraction, with support for MySQL, Postgres, SQLite, and Oracle. Meanwhile, iirc around this time WordPress internally had raw queries strewn about its codebase, which certainly would have been difficult to support multiple DBs. (I haven't looked at WP since then so I don't know if this is still the case.) Faced with shrinking market share and being out-executed on features by WordPress/Automattic, Movable Type actually removed Postgres and SQLite support in response! Then again, these DBs weren't nearly as popular back then as they are today.
- simonw 4y agoThere's a WordPress plugin that adds support for SQLite as an alternative to MySQL. The implementation is (to my mind) simply astonishing: they run regular expressions against the SQL to convert it from MySQL dialect to SQLite! https://github.com/aaemnnosttv/wp-sqlite-db/blob/9a5604cce132fac40c3286f92445a2bf887d842e/src/db.php#L2888 https://github.com/aaemnnosttv/wp-sqlite-db/blob/9a5604cce13... I'm amazed that this works, but apparently it works really well. I would expect it to break the moment it ran into a WordPress plugin that executed custom SQL in a way they hadn't anticipated though.