tzhf / chatguessr

A Twitch chatbot for GeoGuessr.
https://chatguessr.com
MIT License
39 stars 12 forks source link

fix `banned_users` migration #19

Closed ReAnnannanna closed 2 years ago

ReAnnannanna commented 2 years ago

When we add or modify database tables, we always need to do it like this: add a new function at the end of the migrations array. Modifying functions in the migrations array does nothing, because the database tracks which functions were already run, and they are only ever run once. So if you already started Chatguessr once, the initialSetup migration will never be called again. This approach lets us do upgrades to the database when we release a new Chatguessr version, we don't have to delete the DB and start over, but we can upgrade the existing one and keep all the data.