| 1 |
<?php
|
| 2 |
// $Id$
|
| 3 |
|
| 4 |
/**
|
| 5 |
* Implementation of hook_install().
|
| 6 |
*/
|
| 7 |
function uc_userpoints_discount_install() {
|
| 8 |
switch ($GLOBALS['db_type']) {
|
| 9 |
case 'mysql':
|
| 10 |
case 'mysqli':
|
| 11 |
db_query("CREATE TABLE {uc_product_userpoints_discount} (
|
| 12 |
nid mediumint(9) UNSIGNED NOT NULL,
|
| 13 |
discount_status smallint UNSIGNED NOT NULL,
|
| 14 |
PRIMARY KEY (nid)
|
| 15 |
) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
|
| 16 |
db_query("CREATE TABLE {uc_userpoints_discount_txns} (
|
| 17 |
txn_id int unsigned NOT NULL,
|
| 18 |
uid int unsigned NOT NULL,
|
| 19 |
order_id mediumint unsigned NOT NULL,
|
| 20 |
amount int NOT NULL,
|
| 21 |
txn_status int unsigned NOT NULL,
|
| 22 |
expires int NOT NULL,
|
| 23 |
PRIMARY KEY (txn_id),
|
| 24 |
KEY uid (uid),
|
| 25 |
KEY order_id (order_id),
|
| 26 |
KEY txn_status (txn_status)
|
| 27 |
) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
|
| 28 |
break;
|
| 29 |
}
|
| 30 |
}
|
| 31 |
|
| 32 |
function uc_userpoints_discount_uninstall() {
|
| 33 |
db_query("DROP TABLE {uc_product_userpoints_discount}");
|
| 34 |
db_query("DROP TABLE {uc_userpoints_discount_txns}");
|
| 35 |
variable_del('uc_userpoints_discount_rate');
|
| 36 |
}
|
| 37 |
|