backdrop / backdrop-issues

Issue tracker for Backdrop core.
144 stars 40 forks source link

[META][DX][BC] change db_add_field() to db_add_column() #1890

Open jenlampton opened 8 years ago

jenlampton commented 8 years ago

We have a DX problem with db_add_field() in that the term "field" is confusing. We have fields on entities, and fields in forms, but "field" is not a common term in databases, particularly relational databases like MySQL.

We inherited db_add_field() and friends (db_drop_field(), db_change_field(), db_escape_field(), db_field_names(), db_field_exists(), db_field_set_default(), db_field_set_no_default()) from Drupal 7. Let's deprecate the lot of them, and make equivalents using the word "column" instead.

quicksketch commented 8 years ago

The word "field" is also used in a few methods, such as db_update()->fields() and db_select->fields().

This change definitely makes sense in my mind, but it's also a fair amount of API change. Clearly we can help ease the transition with a BC layer (just have all "field" functions/methods call "column" ones). If we take that approach, we could remove BC in 2.x and implement it in 1.x whenever.