[openstreetmap/openstreetmap-website] Rename database tables (Issue #5619)

Andy Allan notifications at github.com
Sun Feb 16 14:15:04 UTC 2025


gravitystorm left a comment (openstreetmap/openstreetmap-website#5619)

> Have you also evaluated the other way around, i.e. change the model names to match the db table names? 

Yes, I've considered it. But I think that in some cases this would not be wanted - for example, renaming the `Follow` model back to `Friend` would spread confusion throughout the codebase, instead of containing it to one line in the `Follow` model.

> In particular the planetdump will probably not work at all with views,
> ...
> osmdbt will probably require some changes, too

Thanks, this is useful stuff to think about.

> I really don't see the need for this change, which in the end is a cosmetic change with a somewhat unfavorable cost-benefit ratio.

It is definitely short-term cost but I think it's a long term benefit. I dislike having such unnecessary complexity for everyone who has to learn about these naming mismatches over many years to come. Of course, if we had renamed some of these tables 10 years ago, we would have been gaining the (admittedly small) benefits spread of many contributors since and we might not even remember the mismatches by now.

> For example, `current_nodes` (with the model name Node vs CurrentNode) contains only the latest **(the current)** versions of nodes, while `nodes` (with the model name OldNode vs Node) includes **all** versions of node definitions.

On the other hand, nobody outside of these tools refers to "current_node", either in the UI, in the API urls, in the wiki or in general conversation. Most people expect nodes to be called "nodes" and I don't think it would be helpful to have a different term here.

However, I can be easily persuaded that "OldNode" is not a very helpful term either. Possibly something like "Node" and "NodeVersion" would be better, or even the question of how much point there is in treating the two separately.... but that's another can of worms.

 Maybe we can set aside the whole nodes/ways/relations stuff for now, and concentrate on the easier ones? My first two proposals would be:

* `friends` -> `follows`
* `changeset_subscribers` -> `changeset_subscriptions`

I can see that `changeset_subscribers` is accessed by cgimap, for example. Would that be a blocker? Are there other reasons to avoid renaming these two tables?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/5619#issuecomment-2661452123
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/issues/5619/2661452123 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250216/468c6130/attachment-0001.htm>


More information about the rails-dev mailing list