Monday, 17 February 2020

Looking for input on my database structure

I'm making a database for my audio player (built on Electron) with sqlite3.My question is regarding one table in particular. Prior to this project, 99% of my programming experience is with WordPress and that database structure, so I copied the wp_postmeta table from there, but I'm not sure if that's what I need.I have 5 tables. A table for songs, one for albums, one for artists, one for app settings, and the meta table that I copied from WordPress. The meta table has 3 columns: (songID|artistID|albumID) | metakey | metavalue.I'm unsure if using a meta table is better than just filling up each other table (songs, albums, artists) with more columns. I would expect each table to have 60+ columns if I did that, which should be fine, but what if I need more?Obviously when push comes to shove, I know it'll work because I've used this structure on tons of PHP projects, but I actually have run into limitations in the past (anyone familiar with the WP_Query class may know that it's limited to ~80 postmeta fields per query). I'm wondering if more columns is the right way to go, or if there's a different structure I should be considering.Also, not sure if it's important, but I'm choosing not to use knex or an ORM.

Submitted February 17, 2020 at 08:45PM by abandonplanetearth

No comments:

Post a Comment