Our core table names are inconsistently named, reflecting the history of how Drupal developed. Some, e.g., 'node', are named in the singular for the object type they hold. Others, e.g., 'users', are named in the plural. Still others, notably 'term_data', have a totally custom name.
As we begin to take giant steps forward in introducing a schema system, http://drupal.org/node/136171, opening the way for a consistent Data API across all object types, a key need is to bring consistency. A one-to-one relationship between object type names and their primary tables will greatly facilitate operations like
drupal_save($type, $item); where $type is e.g. 'node', with primary table 'node'.
All of which is to say, it's time to adopt consistent table-naming.
The attached patch simply renames existing tables in the singular. E.g., 'comments' becomes 'comment'. 'term_data' becomes 'term'. I've also included the joining tables mapping many-to-many relationships. We already had 'term_node'. Now 'blocks_roles', becomes 'block_role', etc.
Since table names are already enclosed in curly brackets, this change will be easy to make for module maintainers--a simple search and replace. (The only difficulty I guess will be if there are existing contrib tables with conflicting names. Update script will need to detect existing tables and rename them.)
Still to do: the update script.
|#89||140860-quote-tables-but-has-issues.patch||5.29 KB||Josh Waihi|
Failed: Failed to run tests.
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch consistent-table-names_0.patch.
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch drupal-table-names.patch.
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch consistent-table-names.patch.