Sample Header Ad - 728x90

Is it good practice to refer to a table with different names in a database schema?

2 votes
3 answers
814 views
We have a database currently running with a table named a certain way (let's say thing for the sake of example), and references to that table named the same way (FK would be named thing_id for instance). We also used to have this thing concept in the code at some point, but then it was decided for various reasons to rename it (let's say to stuff), which was done over time. Now, the code no longer mentions thing except in SQL queries. We unfortunately can't easily rename the table or columns since they're being heavily used, and we were wondering how to deal with new tables referring to this concept of thing/stuff. * Some of the team think that the schema should be the most up-to-date as possible, and that we should use the new naming (stuff) everywhere new (in join table names and FK names referring to thing) * Others think that the database schema should always stay consistent, and thus we should keep using the old naming (thing) anywhere, and handle the renaming in the code itself We're trying to understand what are best practices here and what is advised to do in this situation where the DB schema and the code naming diverge?
Asked by Aweb (21 rep)
Feb 10, 2021, 04:26 PM
Last activity: Feb 12, 2021, 12:39 AM