Skip to content

Instantly share code, notes, and snippets.

@xurizaemon
Created March 19, 2013 09:30
Show Gist options
  • Save xurizaemon/5194768 to your computer and use it in GitHub Desktop.
Save xurizaemon/5194768 to your computer and use it in GitHub Desktop.
Avoid max key length error in civicrm_option_value table.
--- civicrm.mysql.old 2013-03-19 22:28:40.000000000 +1300
+++ civicrm.mysql 2013-03-19 22:29:13.000000000 +1300
@@ -2531,20 +2531,10 @@
`is_active` tinyint DEFAULT 1 COMMENT 'Is this option active?',
`component_id` int unsigned COMMENT 'Component that this option value belongs/caters to.',
`domain_id` int unsigned COMMENT 'Which Domain is this option value for',
- `visibility_id` int unsigned DEFAULT NULL
-,
- PRIMARY KEY ( `id` )
-
- , INDEX `index_option_group_id_value`(
- `value`
- , `option_group_id`
- )
- , INDEX `index_option_group_id_name`(
- `option_group_id`
- , `name`
- )
-
-,
+ `visibility_id` int unsigned DEFAULT NULL,
+ PRIMARY KEY ( `id` ),
+ INDEX `index_option_group_id_value`(value(200), option_group_id),
+ INDEX `index_option_group_id_name`(option_group_id, name(200)),
CONSTRAINT FK_civicrm_option_value_option_group_id FOREIGN KEY (`option_group_id`) REFERENCES `civicrm_option_group`(`id`) ON DELETE CASCADE,
CONSTRAINT FK_civicrm_option_value_component_id FOREIGN KEY (`component_id`) REFERENCES `civicrm_component`(`id`) ,
CONSTRAINT FK_civicrm_option_value_domain_id FOREIGN KEY (`domain_id`) REFERENCES `civicrm_domain`(`id`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment