• she/they/it 🏳️‍⚧️

∍⧽⧼∊ ΘΔ

grey ace, adhdtism


hobbyist game developer, professional procrastinator, and kink trash goblin


avatar by @theobii
Zorotek is @7x9000's
header by Gluepaw


what would be the best way of transferring data from one database to another? the catch here is the old database isn't normalised and the new one is -- I made a lot of mistakes in my early gallery backend, and fixing them is a prerequisite to adding stuff like next/previous linking and artist link pages

I know it's possible to do purely in SQL, but I'd rather not write more logic in that than I'd have to


You must log in to comment.

in reply to @GoopySpaceShark's post:

Not big at all! I think my largest table has only 73 entries right now. Views might be the way to go now that you mention it, had to do quite a few of those for my course assignment a few months ago and I repressed those memories lmao

Splitting the tags out might still be an issue - I've got a single field per gallery entry for the entry's tags, in CSV format. That's one of the mistakes I mentioned before

honestly I'd just:

select id, 'tag1' as tag
  from original where tag1 is not null
union select id, 'tag2' as tag
  from original where tag2 is not null
union select ...

(or plain boolean tests instead of null checks depending on how they're currently stored)

a tedious view to write if there are a lot of tags, but then you have a flat table of (id,tag) pairs, which IMO is the optimal final format anyway but even if you prefer storing it as an array it's a trivial aggregation at the other end!

(edits for rusty sql lol)