--- /Users/matt/Downloads/uc_tablequote/uc_tablequote.install +++ uc_tablequote.install @@ -46,3 +46,51 @@ // Remove tables. drupal_uninstall_schema('uc_tablequote'); } + +function uc_tablequote_update_1() { + $schema['uc_tablequote_methods'] = array( + 'description' => t('List of distinct methods for uc_tablequote'), + 'fields' => array( + 'qmid' => array( + 'type' => 'serial', + 'not null' => TRUE + ), + 'title' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '' + ), + 'weight' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0 + ), + 'quote_mode' => array( + 'type' => 'varchar', + 'not null' => TRUE, + 'default' => 'weight', + 'length' => 15 + ), + 'label' => array( + 'type' => 'varchar', + 'not null' => TRUE, + 'default' => '', + 'length' => 255 + ), + ), + 'primary key' => array('qmid'), + ); + + $ret = array(); + db_create_table($ret, 'uc_tablequote_methods', $schema['uc_tablequote_methods']); + + db_query('INSERT INTO {uc_tablequote_methods} (title, label, quote_mode, weight) VALUES ("%s", "%s", "%s", 0)', t('Default'), t('Default'), variable_get('uc_tablequote_type','weight')); + $qmid = db_last_insert_id('uc_tablequote_methods', 'qmid'); + + $ret = array(); + db_add_field($ret, 'uc_tablequote', 'qmid', array('type' => 'int', 'not null' => TRUE)); + db_query('UPDATE {uc_tablequote} SET qmid = %d', $qmid); + + return $ret; +}