ankane / strong_migrations

Catch unsafe migrations in development

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Idea] Provide custom message prefix/suffix message

jasonkarns opened this issue · comments

Thank you for strong_migrations! As a consultant, I try to introduce it to virtually every client I engage with.

One of the most common problems in response to introducing strong_migrations is internal team comms. If the team has strong documentation sources, (ADRs, or an engineering wiki, github pages docs or even just db/README.md) I create a documentation entry about why to use strong migrations and pointing to the strong_migrations docs.

In the vein of "telling people at the moment of need", it would be great if I could link to this team-specific documentation from a strong_migrations error message. The custom error messages are great, but I only want to prefix the message (or suffix the message) with a link to the custom docs; not replace it wholesale.

Really the idea is: if there is any strong_migrations error: print a link to team-specific docs (which could provide more specialized context, references, and even personnel) in addition to the built-in messaging and doc links.

How about something like

StrongMigrations.error_messages.transform_values! do |message|
  "my custom text #{message}"
end

Thanks @fatkodima, that should work for this.