hackoregon / civic-devops

Master collection point for issues, procedures, and code to manage the HackOregon Civic platform
MIT License
11 stars 4 forks source link

Rename and switch ownership of legacy 2017 databases #208

Open MikeTheCanuck opened 5 years ago

MikeTheCanuck commented 5 years ago

Getting all the 2017 databases under one roof, I'm thinking about me or another person in the future wrangling all the databases as more come online, and thinking that names and users that don't follow a common pattern are going to be hell when it comes time to automate operations (e.g. moving database backups around, migrating, etc) - and becomes just unnecessarily hard to remember what database went with which API project.

I mean to bring the 2017 databases up to the same naming conventions as we have for the 2018 databases. That means renaming databases and swapping owners - historically not something that most of our developers have found easy, and I don't know the proper procedures off the top of my head either. So here goes writing down the plan and how it gets executed.

Inventory of legacy databases

The major change I'd like to make is for the Emergency Response project:

And it would be helpful to rename all the {budget_user, homelessness_user, housing_user, transportation_user} to {budget, homelessness, housing, transportation} or even {budget-readonly, homelessness-readonly, housing-readonly, transportation-readonly}. Then every database operation can do something like for database in databases and just equate "project name" to "database owner". Makes it as easy as possible to equate "user" with "databases associated with that user" too.

znmeb commented 5 years ago

Are those the current names?

MikeTheCanuck commented 5 years ago

That’s exactly how they’re found in the wild

znmeb commented 5 years ago

I'm not sure why you'd want to rename and re-own a database unless the database names match one of this years'. Role creation is easy and doesn't occupy a lot of disk space. I think it's just a couple of small rows in small tables.