CaptainCore Update #19 – Internal Migrations 🌊

This past month was quite productive. What started as an idea back in November has finally landing with CaptainCore v0.10 being completed. Before digging into that, let’s start off with a few other highlights.

Migrations Galor!

Ever curious what it takes to migrate from WordPress custom post types, custom taxonomies and custom fields data over to custom tables, SQL and PHP classes? Well it’s quite complex and messy.

In order to pull off the most recent CaptainCore update I wrote a super complicated, one-time use migrations script. I had run through the migration script on my laptop a bunch of times however that didn’t really prepare me for the late night live migration. This is roughly what that looked like.

  • CaptainCore v0.10 upgrades – First version of WordPress plugin that includes new working database tables and PHP classes.
    • migration-captaincore-v0.9-to-v0.10-alpha.php – The main script which migrated WordPress data over to new custom tables. It produces various JSON files which tracks the original WordPress post IDs along with the new custom table IDs. Getting all of the relationship fields to use the new IDs was a bit tricky as both ends of the relationship were shifting to new IDs.
  • CaptainCore CLI v0.7 upgrades – Switched primary data storage to new dynamic loading database tables and imported a copy of the new custom tables for each Captain into the CaptainCore CLI. Also bundled in copy of new CaptainCore v0.10 WordPress plugin to power the new data.
  • And a seemingly endless Trello TODO list.
Using Trello to track v0.9 to v.10 CaptainCore upgrade process

Upgrades were a success. 😅

It’s been a few days since doing the big upgrade on my own instance of CaptainCore and have fixed the critical bug. Changing data structures was necessary to move this project forward however I don’t recommend doing such a big change without a seriously considering why it’s necessary. That said I’m now looking forward to a less ambitious project for the next month. This was an intense last few months. Here are a few goodies which come with the new version.

  • pushState JS + WordPress routing hack – Navigating CaptainCore is now more consistent and will properly route to the correct page if reloaded. I’ll go into more detail on this in a separate blog post (coming soon). The sidebar navigation now highlights the current page.
  • Users management page – This new section allows the administrator to manage users. It handles basic things like name changes, password resets and permissions to CaptainCore accounts.
  • Consistent labeling and layout – Little things like headers now have a following a common format of “Listing <number> <items>”. I’m starting to adopt Vuetify’s datatable component throughout CaptainCore for better performance and a more common layout.

Was it worth it? 100%. If just for performance sake! ⚡

Most of my customers only see 10, 20 or maybe 100 sites listed within CaptainCore. I see over 1000. As a heavy user, I’m seeing a massive performance boost. Most of the speed increase comes from improvements made to the Vue.js template however… under the hood, the database queries are significantly faster.

Until next month, onward!