It seems there is enough interest to discuss the planning stages of KDYv2. As the title might betray, there is a lot of technical details going around, so be so warned.
Right now, I'm trying to decide on a database design for how content gets stored. There are currently a few patterns in my head that I'm debating between:
Pattern 1: 'Items' Table and Detail Tables
The 'Items' table will hold things like the ID of a piece of content, it's name, who created it, when it was created. Things that are pretty universal. There are then going to be Detail tables where specialized data sits. Let's take three examples: Ships, Upgrade Types, and Damage Card Classes (and I chose these for a reason). the Detail_Ships table will hold things like the Hull Value, the Speed chart, the silhouette id, the upgrade bar, and so on. The Upgrade_Types will hold data like the path to the SVG icon for the upgrade. The Damage_Class table ("crew" and "ship" in armada) won't actually need to hold on to any pieces of data, because all the bases are covered on the common table (I actually dislike that inconsistency - if it appears in the common table, it should have a detail table).
Pattern 2: Independent tables
Every class of content is contained in their own table. Ships are in their own table, Squadrons, Upgrade Types, Dice, etc. The problem with this is searches and the front-page feed. Union-ing a bunch of tables in order to find the most recently created content is... problematic. There are also some implications when it comes to the API that I'm working on for TTS. Essentially I'd like to have the TTS integration be Type Agnostic. Meaning that I want to make it so that you can import item id 4568 and the importer will know it's a ship instead of having to tell the importer that it's a ship.
Pattern 3: 'Items' Table and Detail Tables as well as Meta-items Tables
Basically the same thing as above, except the only thing that gets stored in the Items table are things like Ships, Squadrons, Damage Cards, Upgrade Cards, etc. All of these have a detail table that can be joined with the Items as above. Other things, like Upgrade Types, Damage Classes, Silhouettes, Dice, and so on are actually stored in separate tables independent of the Items table completely. This is actually how KDY functions right now. My problem with this is that the Items table is actually fairly good thing to have if I want to list out "here's all the most recent content", but this model doesn't work well for including things like Dice in that feed. That's why I have to make a bit of an announcement when I add support for a new Upgrade Type or Keyword. You guys don't see that.
Pattern 4: Full Distro aka ALL THE TABLES!
This one I'm still forming in my head. This takes pattern 1 to the extreme. Instead of a central items table where some content fits into it and some doesn't, imagine having ALL pieces of content on their own table, but link them together using a very very simple IDs table. The IDs table would have only a few fields. HashID, ContentType and ContentId. You send a HashId, it then looks that up, decides what table to refer to based on ContentType and pulls all the information from (mostly) one table using the ContentId.
The issue remains, however: searches and feeds get hairy. I could make it so that ALL searchable fields (like an Upgrade Card's Text or a Squadron's name) get stored in another table that can be searched, but I worry about having data in so many places. HOWEVER, this may end up helping quite a bit when it comes to internationalization. Imagine having the same card in multiple languages, for example. This means that a single Squadron Card could have multiple entries in the Text table for it's name - one for each language that it supports. Issue with this: multiple data types. Ace Squadron special text would have to be stored in a different table than Squadron Names because one needs to be a text field while the other is a smaller varchar... That's not a deal-breaker, but it does complicate things.
To fix the "latest content" feed issue presented by the similarity between Pattern 4 and Pattern 2, I would create an Activity table. When someone adds a Ship card, it get's added to the Activity table along with a few other important values. This would allow for people to subscribe to specific feeds. Want to track what I'm doing? Click on "Watch FoaS" and now stuff that I make shows up on your home page. Is that to Social-media-y? maybe, but I kinda dig it.
I feel like this is the most complicated execution, though. There's a lot of moving parts and it's a bit daunting.
Edited by FoaS