drupal-6drupal-schema

drupal 6: schema api to specify exact size of int data type


Using the Drupal 6 schema API, how do you specify the EXACT size of an int data type? For example, I can do the below query in MySQL:

create table test (foo int(11) unsigned not null);

The drupal 6 schema API only gives me these fixed sizes options of: tiny, small, normal, medium, big.

http://drupal.org/node/159605

I want to create an 'int' data type with a size of 11, to match up with the default drupal 'users' table in the 'created' field.


Solution

  • Looks like I found a way to get it to 11! You CANNOT set your field to be 'unsigned' => 'true'. If you do that, then it auto-defaults to int(10). But if you leave it out, or set it to 'unsigned' => 'false', then it will give you int(11)!