You are here

function uc_coupon_install in Ubercart Discount Coupons 5

Same name and namespace in other branches
  1. 6 uc_coupon.install \uc_coupon_install()

@file Ubercart uc_coupon.module schema

File

./uc_coupon.install, line 7
Ubercart uc_coupon.module schema

Code

function uc_coupon_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("CREATE TABLE {uc_coupons} (\n        cid int(11) NOT NULL auto_increment,\n        name varchar(30) NOT NULL,\n        code varchar(40) NOT NULL,\n        value decimal(6,2) NOT NULL,\n        type varchar(12) NOT NULL default 'price',\n        status int(1) NOT NULL default '1',\n        valid_from int(11) default NULL,\n        valid_until int(11) default NULL,\n        max_uses int(4) NOT NULL,\n        minimum_order decimal(6,2) NOT NULL default 0.00,\n        data text,\n        bulk int(1) NOT NULL default 0,\n        bulk_seed char(32) NOT NULL,\n        PRIMARY KEY  (cid)\n        )");
      db_query("CREATE TABLE {uc_coupons_orders} (\n        cuid int(11) NOT NULL auto_increment,\n        cid int(11) NOT NULL,\n        oid int(11) NOT NULL,\n        value decimal(10,2) NOT NULL,\n        code varchar(40) NOT NULL,\n        PRIMARY KEY  (cuid)\n        )");
      break;
  }
}