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

Rename "street_edge" to "street" in the database and elsewhere #3754

Open
misaugstad opened this issue Nov 23, 2024 · 0 comments
Open

Rename "street_edge" to "street" in the database and elsewhere #3754

misaugstad opened this issue Nov 23, 2024 · 0 comments

Comments

@misaugstad
Copy link
Member

Brief description of problem/feature

After spending ten years typing "street_edge" / "street_edge_id" / "street_edge_region" / "street_edge_priority' and such, I think that we could probably rename these things to "street" / "street_id" / "street_region" / "street_priority". It really is a pain while I am constantly typing out SQL queries to diagnose issues on the fly.

The change is primarily for QoL when typing stuff out, but it also will make our code shorter and easier to read. I would argue that the word "edge" doesn't actually help anyone understand what we're working with, it probably is more confusing than anything to most people!

I got so annoyed by this today, that I finally looked up something that I had thought didn't exist but certainly does! You can shorten your join if the column names match with the "USING" keyword! My least favorite join to write has always been:

FROM street_edge
INNER JOIN street_edge_region ON street_edge.street_edge_id = street_edge_region.street_edge_id

Which it turns out can be significantly easier:

FROM street_edge
INNER JOIN street_edge_region USING(street_edge_id)

But... what if it was even easier...

FROM street
INNER JOIN street_region USING(street_id)

Obviously low priority, but would be nice to have an intern make the change!

Potential solution(s)

To make this change, we would need to:

  1. Change all instances of "street_edge" -> "street", "streetEdge" -> "street", "StreetEdge" -> "Street", etc. throughout our code.
    • Note that we would have to take care to make sure that if we named a variable streetEdge that we didn't also name another one street nearby already. It's possible that this poor practice was used once or twice in the JavaScript 🤷
    • We should also just check for any other instances of the word edge/Edge/EDGE. It's possible that we used that as a shorthand in places where space was at a premium.
  2. Add an evolutions file that renames all of the tables and column names. Should also verify that the indexes, foreign keys, etc are updated automatically. I expect that they are.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant