} // END - if
// Version number
-setThisExtensionVersion('0.0.0');
+setThisExtensionVersion('0.0.1');
// Version history array (add more with , '0.1' and so on)
-setExtensionVersionHistory(array('0.0.0'));
+setExtensionVersionHistory(array('0.0.0', '0.0.1'));
switch (getExtensionMode()) {
case 'register': // Do stuff when installtion is running
- // This extension requires an up-to-date user
+ // This extension requires an up-to-date ext-user
addExtensionDependency('user');
// Coupon data
`coupon_type` ENUM('CODE','API') NOT NULL DEFAULT 'CODE',
`total_created` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
`total_cashed` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
-`points` FLOAT(20,5) NOT NULL DEFAULT 0.00000,
+`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'");
// Configuration entries
addConfigAddSql('coupon_default_time', 'BIGINT(20) NOT NULL DEFAULT ' . (getOneDay() * 7));
- addConfigAddSql('coupon_default_points', 'FLOAT(20,5) NOT NULL DEFAULT 100.00000');
- addConfigAddSql('coupon_points_account', "ENUM('ORDER','GENERAL') NOT NULL DEFAULT 'ORDER'");
- addConfigAddSql('coupon_payment_method', "ENUM('DIRECT','REF') NOT NULL DEFAULT 'DIRECT'");
- addConfigAddSql('coupon_locked_points_mode', "ENUM('LOCKED','UNLOCKED') NOT NULL DEFAULT 'LOCKED'");
+ addConfigAddSql('coupon_default_points', 'FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 100.00000');
addConfigAddSql('coupon_autopurge_time', 'BIGINT(20) NOT NULL DEFAULT ' . (getOneDay() * 7));
addConfigAddSql('coupon_userid', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 0');
case 'update': // Update an extension
switch (getCurrentExtensionVersion()) {
case '0.0.1': // SQL queries for v0.0.1
- addExtensionSql('');
+ addConfigDropSql('coupon_points_account');
+ addConfigDropSql('coupon_payment_method');
+ addConfigDropSql('coupon_locked_points_mode');
+
+ // This extension's update requires an up-to-date ext-sql_patches and ext-order
+ addExtensionDependency('sql_patches');
+ 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')");
// Update notes (these will be set as task text!)
setExtensionUpdateNotes('');