diff --git a/cck.install b/cck.install index 49a2f9b2c..82da480b1 100644 --- a/cck.install +++ b/cck.install @@ -3,7 +3,7 @@ * Implementation of hook_install(). */ function cck_install() { - + } /** @@ -15,15 +15,21 @@ function cck_uninstall() { /** * Implementation of hook_schema. - * + * * Create a table to hold data for field settings CCK is managing, - * like custom PHP code for Allowed values and default values that we + * like custom PHP code for Allowed values and default values that we * don't want in core. */ function cck_schema() { - + $schema['cck_field_settings'] = array( 'fields' => array( + 'id' => array( + 'description' => 'The unique identifier for this cache segment.', + 'type' => 'serial', + 'unsigned' => TRUE, + 'not null' => TRUE, + ), 'field_name' => array( 'type' => 'varchar', 'length' => 32, @@ -48,7 +54,7 @@ function cck_schema() { 'length' => 32, 'not null' => FALSE, 'description' => 'The name of the language, NULL for field settings.', - ), + ), 'setting_type' => array( 'type' => 'varchar', 'length' => 32, @@ -89,7 +95,25 @@ function cck_update_7000() { 'length' => 32, 'not null' => FALSE, 'description' => 'The name of the language, NULL for field settings.', - ); + ); db_add_field('cck_field_settings', 'language', $field); } } + +/** + * Add a primary key. + */ +function cck_update_7001() { + if (!db_field_exists('cck_field_settings', 'id')) { + db_add_field('cck_field_settings', 'id', + array( + 'description' => 'The unique identifier for this cache segment.', + 'type' => 'serial', + 'unsigned' => TRUE, + 'not null' => TRUE, + ), + array('primary key' => array('id'))); + } + // Add a primary key. + db_add_primary_key('cck_field_settings', array('id')); +}