| 1 | -- /******************************************************* |
| 2 | -- * CRM-10477 - Extensions updates |
| 3 | -- *******************************************************/ |
| 4 | CREATE TABLE `civicrm_extension` ( |
| 5 | `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'Local Extension ID', |
| 6 | `type` enum('payment', 'search', 'report', 'module') NOT NULL , |
| 7 | `full_name` varchar(255) NOT NULL COMMENT 'Fully qualified extension name', |
| 8 | `name` varchar(255) COMMENT 'Short name', |
| 9 | `label` varchar(255) COMMENT 'Short, printable name', |
| 10 | `file` varchar(255) COMMENT 'Primary PHP file', |
| 11 | `schema_version` varchar(63) COMMENT 'Revision code of the database schema; the format is module-defined', |
| 12 | `is_active` tinyint DEFAULT 1 COMMENT 'Is this extension active?' , |
| 13 | PRIMARY KEY ( `id` ) , |
| 14 | UNIQUE INDEX `UI_extension_full_name`( |
| 15 | `full_name` |
| 16 | ), |
| 17 | INDEX `UI_extension_name`( |
| 18 | `name` |
| 19 | ) |
| 20 | ) ENGINE=InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci; |
| 21 | |
| 22 | -- assuming first value of array $locales is always en_US |
| 23 | {if $multilingual} |
| 24 | INSERT INTO civicrm_extension (label, full_name, name, type, file, is_active) |
| 25 | SELECT ov.label_{$locales.0}, ov.value, ov.name, ov.grouping, ov.description_{$locales.0}, ov.is_active |
| 26 | FROM civicrm_option_group og |
| 27 | INNER JOIN civicrm_option_value ov ON og.id = ov.option_group_id |
| 28 | WHERE og.name = "system_extensions"; |
| 29 | {else} |
| 30 | INSERT INTO civicrm_extension (label, full_name, name, type, file, is_active) |
| 31 | SELECT ov.label, ov.value, ov.name, ov.grouping, ov.description, ov.is_active |
| 32 | FROM civicrm_option_group og |
| 33 | INNER JOIN civicrm_option_value ov ON og.id = ov.option_group_id |
| 34 | WHERE og.name = "system_extensions"; |
| 35 | {/if} |
| 36 | DELETE FROM civicrm_option_group WHERE name = "system_extensions"; |
| 37 | -- Note: Deletion cascades to civicrm_option_value |