At present it's possible to annotate individual columns within a table with descriptions about what that column holds or other useful notes. I'd like to be able to do the same at the table label. The schema api allows for this with a 'description' element for each table.

I'm importing data using tw and migrate modules, from a source schema with very similar sounding table names, e.g. cms_additional_users, cms_users, cms_module_feusers_users, and there's more! It'd be useful if I could add a brief description to each table to help me easily identify what each table is at a glance. It could also be used to add notes about the current state of migration or other notes.

Ideally this description (or first X chars of it) would be displayed in the list at admin/content/tw. It should also be displayed in the header of the corresponding view created.

Cheers,
Stella

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

gcassie’s picture

Status: Active » Needs work
FileSize
2.8 KB

Here's an attempt at this. It just loads table comments into a text area in the analysis form, and then saves them back on submit.

It does not affect the view header, though.

moshe weitzman’s picture

would this require write access to the legacy tables? if so, i think thats a problem.

mikeryan’s picture

Status: Needs work » Active

Altering tables is a very slippery slope - and I've chosen to have Table Wizard stay clear of it. I have repeatedly been tempted to have Table Wizard, say, set a primary key or create an index. And then, what about altering column types for imported CSVs that come in all as text? And then... well, why not reimplement phpMyAdmin within the Table Wizard?

So, Table Wizard is read-only as far as the tables it manages goes. My party line is that there are fine tools out there for managing db tables, and I don't feel like reinventing the wheel (two wheels, actually, with Postgres to consider). If someone wants to have a db management tool in Drupal (which, if it makes use of TW to views-enable the tables, isn't entirely unreasonable), that should be an independent module.

Now, as for the basic request, it's quite reasonable, but should be implemented the same way as column annotations - add a comments field to tw_tables and save descriptions there.

Thanks.

gcassie’s picture

That makes sense, I was trying to avoid altering the structure of the TW tables. I will take another stab at this in the next few days.

gcassie’s picture

Status: Active » Needs work
FileSize
2.74 KB

This patch adds a "meta" column to the tw_tables table. Right now it is just storing a table description, but if there were a desire to store other information (like collation or something), it could be managed through this field without further modifying the database structure.

Still doesn't impact views.