function uc_payment_update_1 in Ubercart 5
File
- payment/
uc_payment/ uc_payment.install, line 61
Code
function uc_payment_update_1() {
$ret = array();
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
$ret[] = update_sql("CREATE TABLE {uc_payment_cod} (\n order_id mediumint(9) NOT NULL,\n delivery_month smallint(6) NOT NULL,\n delivery_day smallint(6) NOT NULL,\n delivery_year smallint(6) NOT NULL,\n PRIMARY KEY (order_id)\n ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
break;
case 'pgsql':
$ret[] = update_sql("CREATE TABLE {uc_payment_cod} (\n order_id mediumint(9) NOT NULL,\n delivery_month smallint(6) NOT NULL,\n delivery_day smallint(6) NOT NULL,\n delivery_year smallint(6) NOT NULL,\n PRIMARY KEY (order_id)\n ) ");
break;
}
$max_id = db_result(db_query("SELECT MAX(receipt_id) FROM {uc_payment_receipts}"));
if (!empty($max_id)) {
$ret[] = update_sql("INSERT INTO {sequences} VALUES ('{uc_payment_receipts}_receipt_id', {$max_id})");
}
$ret[] = update_sql("ALTER TABLE {uc_payment_receipts} CHANGE receipt_id receipt_id MEDIUMINT(9) NOT NULL");
$max_id = db_result(db_query("SELECT MAX(check_id) FROM {uc_payment_check}"));
if (!empty($max_id)) {
$ret[] = update_sql("INSERT INTO {sequences} VALUES ('{uc_payment_check}_check_id', {$max_id})");
}
$ret[] = update_sql("ALTER TABLE {uc_payment_check} CHANGE check_id check_id MEDIUMINT(9) NOT NULL");
return $ret;
}