mysqldrupaldrupal-schema

Drupal field values and longtext


Long time mysql/php user, first time Drupal user. Actually, I'm not doing the Drupal development (I'm just using the database to pull in some data to a separate application), and I'm just trying to figure out if this is how it's supposed to work:

Every one of the "value" fields in the content_type_* tables is of type LONGTEXT. This seems a bit nuts to me (not to mention a pain to have to CAST a lot of values if I don't want a string), but is this how Drupal works? Or does (should?) the developer have specified a "type" in some way in the Drupal admin.

Clearly the appeal of Drupal is its modularity and the fact that it seems to "make the database for you", but I'm not liking the schema it's producing at all.


Solution

  • CCK does that because CCK can't know how long the values you'll permit will be (especially when it's a free-entry textarea). Any Drupal dev who knows enough to want to change it from a LONGTEXT to something that better suits that particular field has the know-how to go into the DB and tweak it themselves.

    Drupal does a lot for you, but there are certain things best left up to the developer. This is one of them, as is the related issue of adding indexes to certain CCK content_type_* fields you're likely to filter on.