You are here

function uc_payment_install in Ubercart 5

Same name and namespace in other branches
  1. 6.2 payment/uc_payment/uc_payment.install \uc_payment_install()
  2. 7.3 payment/uc_payment/uc_payment.install \uc_payment_install()

File

payment/uc_payment/uc_payment.install, line 3

Code

function uc_payment_install() {
  $t = get_t();
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("CREATE TABLE {uc_payment_receipts} (\n        receipt_id mediumint(9) NOT NULL,\n        order_id mediumint(9) NOT NULL,\n        method varchar(32) NOT NULL,\n        amount decimal(10,2) NOT NULL,\n        uid mediumint(9) NOT NULL,\n        data text NOT NULL,\n        comment tinytext NOT NULL,\n        received int(11) NOT NULL,\n        PRIMARY KEY (receipt_id),\n        KEY order_id (order_id)\n      ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
      db_query("INSERT INTO {uc_order_statuses} (order_status_id, title, state, weight, locked) VALUES ('payment_received', '" . $t('Payment received') . "', 'payment_received', 10, 1);");
      break;
    case 'pgsql':
      db_query("CREATE TABLE {uc_payment_receipts} (\n        receipt_id serial NOT NULL,\n        order_id integer NOT NULL,\n        method varchar(32) NOT NULL,\n        amount decimal(10,2) NOT NULL,\n        uid integer NOT NULL,\n        data text NOT NULL,\n        comment text NOT NULL,\n        received integer NOT NULL,\n        PRIMARY KEY (receipt_id)\n      );");
      db_query("CREATE INDEX {uc_payment_receipts}_order_id ON {uc_payment_receipts} (order_id)");
      db_query("INSERT INTO {uc_order_statuses} (order_status_id, title, state, weight, locked) VALUES ('payment_received', '" . $t('Payment received') . "', 'payment_received', 10, 1);");
      break;
  }
}