smogon / Porygon-Z

The Bot for the Official Smogon Discord (WIP)
https://discord.gg/smogon
MIT License
13 stars 6 forks source link

Database Table Version Control #13

Closed HoeenCoder closed 4 years ago

HoeenCoder commented 4 years ago

From @TheJetOU https://github.com/smogon/Porygon-Z/commit/7b061bc4c8b793e21e50e02180cf71dac5de976a#r37860540

You might want to use a migration library [0] for increased flexibility with rolling forward / rolling back.

[0] - https://www.npmjs.com/package/postgrator, https://www.npmjs.com/package/node-pg-migrate etc.

Yes, we should do something like this, good catch. I'm open to using one of these, a different library, or something house made. I skimmed over the libraries last night and currently I prefer the former (postgrator) though I'm open to all the other options still.

Whatever we do it should allow the bot to upgrade the database from an older commit's version to whatever it currently needs to run. If you interested in taking this on, feel free otherwise I'll get to it sooner rather than later.