glowfic-constellation / glowfic

The Glowfic Constellation
https://www.glowfic.com
MIT License
16 stars 10 forks source link

Audit unused table columns #419

Open Throne3d opened 7 years ago

Throne3d commented 7 years ago

Check the db/structure.sql file for all the columns that are extant, then figure out which of them are unused or unexposed, and either expose them or remove them as necessary.

unused (partial and maybe inaccurate; things to check which may be used):

other queries:

Marri commented 7 years ago

messages.visible_*box is definitely used; we use that for deletion, since otherwise deleting something from your outbox would delete it from the recipient's inbox as well. See Messages Controller.

PasswordReset.used? is definitely a thing, see .unused scope.

messages.marked_* was used and got removed cause it was hard with threading and not actually used at all; we can probably drop until and unless we want it back.

board sections notify_* was a forward looking thing. We should probably sit and think about how we're designing notifications before we drop these in case we want them.

post_tags.suggested was also forward looking and seems likely to be helpful once we build it.

exposing board_section.status seems fine but I am worried it may go the way of "series.complete" in AO3, in that no one actually changes it.

ugh threads. ugh. i should probably look/care at some point.

I am disinclined to change db architecture because it's hard to use in the dev console; if that's the only pain point, that feels like the answer is "be more careful in the dev console".

I do not much want to use foreign_keys in the same way I don't much want to use triggers; that feels like an application layer failure that we're making the DB do work to compensate for, but we can look I guess.

421's prior is in fact reply ordering independent of ID. that first.

defaults sound good, index analysis sounds good though the downside is usually just space (and sometimes slower updates but we're probably not big enough to care) and citext sounds good though yes we'll probably wind up pulling some out (I expect PB/facecast to also get pulled into a tag, for multi facecast people)

Throne3d commented 7 years ago

I am disinclined to change db architecture because it's hard to use in the dev console; if that's the only pain point, that feels like the answer is "be more careful in the dev console".

It's also a pain in the scraper, and a thing we plausibly have to take into account in controllers, and could be annoying when we decide to set up ordering of replies – I'm not sure there is a way to make it much easier than our current system but we could at least make it a single "last_reply" then fetch the user from that, instead of having a separate "last_user"? (This could potentially be slightly more memory expensive, but not much more, we'd just have to be slightly careful when making the transition – also I don't think post lists are our main memory concern.)

exposing board_section.status seems fine but I am worried it may go the way of "series.complete" in AO3, in that no one actually changes it.

Most people seem to care about metadata at least a little or else are prodded into caring (and if we get the feature a lot of people would find convenient, where there are helpers allowed to edit specific people's metadata, this seems likely to be a nonissue – #239 or #4 or thereabouts). <3