setExtensionAlwaysActive('Y');
switch (getExtensionMode()) {
- case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
+ case 'register': // Do stuff when installation is running
// SQL commands to run
- addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_countries`');
- addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_countries` (
+ addDropTableSql('countries');
+ addCreateTableSql('countries', "(
`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`code` CHAR(2) NOT NULL DEFAULT 'DE',
`descr` VARCHAR(255) NOT NULL DEFAULT 'Deutschland',
`is_active` ENUM('Y','N') NOT NULL DEFAULT 'N',
KEY (`code`),
PRIMARY KEY (`id`)
-) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci");
+) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Country codes and their full-length descriptions'");
addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_countries` (code, descr, is_active) VALUES ('DE','Deutschland','Y')");
// Admin menu
case 'remove': // Do stuff when removing extension
// SQL commands to run
- addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_countries`');
+ addDropTableSql('countries');
addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='country'");
break;