View source
<?php
function uc_product_panes_schema() {
$schema['uc_product_panes'] = array(
'fields' => array(
'ppid' => array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'pfid' => array(
'type' => 'int',
'not null' => TRUE,
),
'nid' => array(
'type' => 'int',
'not null' => TRUE,
),
'model' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'pane_id' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'enabled' => array(
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
),
),
'primary key' => array(
'ppid',
),
'indexes' => array(
'ucpp' => array(
'nid',
'model',
),
'pfid' => array(
'pfid',
),
),
);
return $schema;
}
function uc_product_panes_install() {
drupal_install_schema('uc_product_panes');
}
function uc_product_panes_uninstall() {
drupal_uninstall_schema('uc_product_panes');
update_sql("DELETE FROM {uc_product_features} WHERE fid = 'panes'");
$types = node_get_types('names');
$panes = _checkout_pane_list();
foreach ($types as $typeid => $typename) {
foreach ($panes as $pane) {
variable_del('ucpp_class_' . $typeid . '_pane_' . $pane['id'] . '_enabled');
}
}
}
function uc_product_panes_update_6001() {
$ret = array();
db_drop_primary_key($ret, 'uc_product_panes');
db_query("ALTER TABLE {uc_product_panes} ADD COLUMN ppid INT(10) AUTO_INCREMENT NOT NULL FIRST, ADD PRIMARY KEY (ppid)");
db_add_field($ret, 'uc_product_panes', 'model', array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
));
db_add_index($ret, 'uc_product_panes', 'ucpp', array(
'nid',
'model',
));
db_add_index($ret, 'uc_product_panes', 'pfid', array(
'pfid',
));
return $ret;
}