Wednesday, April 8, 2015

ALTER comic DROP MySQL

I've decided to migrate my comic away from MySQL. I have my reasons. Lots of people have reasons.

Some people complain that MySQL isn't truly open source anymore. It's true that it does have closed-source modules now. And Oracle is not exactly forthcoming with test cases or security patches. But these things don't bother me that much, since I'm just looking for a free, easy to use database.

Some people say that MySQL is not standards-compliant. Well, this is not my main reason but certainly a factor. I've been doing SQL for a looong time, and MySQL's is weird. I've always just dealt with it. But it would be nice to not have to think about is this the MySQL way or the normal way when I'm working on something.

Some people say that the performance doesn't scale as well as other RDBMS software. I don't know. I only ever use it for basic, low-performance stuff.

Some people say that MySQL has become stagnant. Ah, this is certainly a factor for me. It seems as though Oracle doesn't have a lot of interest in making MySQL better. And why would they? It completes with their classic RDBMS, which makes them big money. Honestly, up until this point I've just been happy that they haven't killed it off altogether. Some people have forked MySQL, like MariaDB, to move the product forward.

PostgreSQL. I'm going back.

But it's the new features in PostgreSQL that really have me wanting to change. Specifically the native JSON support. Since I store and work with my comic data in JSON, it makes sense to use a database that treats JSON as a first-class data type. I know that many of the popular NoSQL databases do this, but I don't have other use cases that drive me towards a NoSQL solution.

I once used Postgres for all my projects. It was my go-to RDBMS product back around 2001. But then I hopped on the MySQL train with everyone else and rode it to Disillusionment Town. Now I'm heading back.

I'm currently working with the node-postgres client pg to convert my comic. Thanks to my prior design decisions, it is fairly easy to swap one product for another. I use a module I called data.js which encapsulates all the database details. I've swapped it out for a new pg-data.js which implements all the same functions and I'm working through the issues. The Node pg module uses a fairly different design pattern than the mysql module does, particularly for pooled connections. That's really my biggest hurdle.

And now for the comic! They haven't been very deep lately. I've been putting too much time into the GitHub Game Off for the past 2 and half weeks. But I am working on a very interesting set for later in the month.