Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

πŸ› οΈ Neighborhood: Install strong_migrations to catch risky operations #1177

Closed
KellyAH opened this issue Mar 3, 2023 · 5 comments
Labels
πŸ› οΈ infrastructure ci, build, deploy, networking, etc. πŸ” security Relates to security vulnerabilities

Comments

@KellyAH
Copy link
Contributor

KellyAH commented Mar 3, 2023

installing strong_migrations were mentioned in #1169 (comment)

strong_migrations will help us catch risky operations and safely ignore and drop deprecated database columns

@zspencer zspencer added this to the 1.0 - Andromeda milestone Mar 3, 2023
@zspencer zspencer added πŸ” security Relates to security vulnerabilities πŸ› οΈ infrastructure ci, build, deploy, networking, etc. labels Mar 3, 2023
@rosschapman
Copy link
Contributor

rosschapman commented Apr 12, 2023

βž• for this because I hit a bad error when setting up my environment. There are two migrations that reference a UtilityHookup model that no longer exists.

db/migrate/20210710224638_encrypt_utility_hookup_configuration.rb
db/migrate/20230119012952_remove_jitsi_plaid_utilities.rb

Although, after downgrading from Postgres 14 to Postgres 12 I could somehow run db:migrate successfully -- don't ask me why (yet! πŸ˜…).

It sounds like this gem would prevent this problem. Relatedly, what's the best way to get rid of bad/defunct migrations?

@rosschapman
Copy link
Contributor

@zspencer @KellyAH perhaps this would be a good first task for me while I'm getting situated with the system, and could work on during tomorrow's huddle?

@KellyAH
Copy link
Contributor Author

KellyAH commented Apr 12, 2023

get rid of bad/defunct migrations

Maybe https://guides.rubyonrails.org/active_record_migrations.html#schema-dumping-and-you can help.

@anaulin
Copy link
Member

anaulin commented Apr 12, 2023

@rosschapman if you feel moved to tackle this, go for it! πŸ’ͺ🏼 Generally speaking, no need to ask for permission, you can just leave a note here saying that you plan to work on it, to avoid effort duplication, and take it on.

@zspencer zspencer changed the title Neighborhood: Install strong_migrations to catch risky operations πŸ› οΈ Neighborhood: Install strong_migrations to catch risky operations Apr 13, 2023
rosschapman added a commit that referenced this issue Apr 13, 2023
- #1177

This change is part of an effort to add guard rails for devs writing migrations and catch *unsafe* and *illegal* operations on the database.

NOTE: There are other types of "bad" migrations that will not be caught by this gem. For example, referencing an Active Record model to execute DML. For those cases we should consider other static analysis methods like rubocop.
zspencer pushed a commit that referenced this issue Apr 13, 2023
πŸ›  Neighborhood: Adds strong_migrations gem

- #1177

This change is part of an effort to add guard rails for devs writing migrations and catch *unsafe* and *illegal* operations on the database.

NOTE: There are other types of "bad" migrations that will not be caught by this gem. For example, referencing an Active Record model to execute DML. For those cases we should consider other static analysis methods like rubocop.
@zspencer
Copy link
Member

Wooo !! THank you @rosschapman !!!

@zspencer zspencer removed this from the 1.0 - Andromeda milestone May 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
πŸ› οΈ infrastructure ci, build, deploy, networking, etc. πŸ” security Relates to security vulnerabilities
Projects
None yet
Development

No branches or pull requests

4 participants