X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fextensions%2Fext-coupon.php;h=7b532b083011331531ba128adda8a6bcb4de9a03;hb=ed37c3c3ccfe6b0bc15315fe79d5eef0b441fa9f;hp=cce501740378b99aeefc617dfa640c4d121ad066;hpb=9f30db83eedcaf1d265d973e4bffcd3fa7df9bde;p=mailer.git diff --git a/inc/extensions/ext-coupon.php b/inc/extensions/ext-coupon.php index cce5017403..7b532b0830 100644 --- a/inc/extensions/ext-coupon.php +++ b/inc/extensions/ext-coupon.php @@ -56,7 +56,7 @@ switch (getExtensionMode()) { // Coupon data addDropTableSql('coupon_data'); - addCreateTableSql('coupon_data', "( + addCreateTableSql('coupon_data', " `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, `coupon_created` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, `coupon_expired` TIMESTAMP NULL DEFAULT NULL, @@ -65,21 +65,21 @@ switch (getExtensionMode()) { `total_cashed` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, `points` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000, `coupon_description` TEXT, -PRIMARY KEY (`id`) -) TYPE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Created coupons'"); +PRIMARY KEY (`id`)", + 'Created coupons'); // Coupon->user connection table addDropTableSql('user_coupons'); - addCreateTableSql('user_coupons', "( + addCreateTableSql('user_coupons', " `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, `coupon_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, `userid` BIGINT(2) UNSIGNED NOT NULL DEFAULT 0, `coupon_code` VARCHAR(30) NULL DEFAULT NULL, `cashed_on` TIMESTAMP NULL DEFAULT NULL, PRIMARY KEY (`id`), -UNIQUE KEY `coupon_user` (`coupon_id`,`userid`), -UNIQUE KEY (`coupon_code`) -) TYPE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Coupon->user connection'"); +UNIQUE KEY `coupon_user` (`coupon_id`, `userid`), +UNIQUE KEY (`coupon_code`)", + 'Coupon->user connection'); // Configuration entries addConfigAddSql('coupon_default_time', 'BIGINT(20) NOT NULL DEFAULT ' . (getOneDay() * 7)); @@ -138,7 +138,15 @@ UNIQUE KEY (`coupon_code`) addExtensionDependency('order'); // Insert data in new table - addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_points_data` (`ext_name`,`column_name`,`locked_mode`,`payment_method`) VALUES('coupon','order_points','LOCKED','DIRECT')"); + addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_points_data` (`subject`, `column_name`, `locked_mode`, `payment_method`) VALUES ('coupon_cashed','order_points','LOCKED','DIRECT')"); + + // Update notes (these will be set as task text!) + setExtensionUpdateNotes(''); + break; + + case '0.0.1': // SQL queries for v0.0.1 + // Update data in points_data table + addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_points_data` SET `subject`='coupon_cashed' WHERE `subject`='coupon' LIMIT 1"); // Update notes (these will be set as task text!) setExtensionUpdateNotes('');