Last active
August 29, 2015 14:03
-
-
Save amcgowanca/f6e98746a80612518561 to your computer and use it in GitHub Desktop.
Views Argument Cache with Indexing: Update argument index table `aid` length
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @file | |
*/ | |
/** | |
* Implements hook_schema_alter(). | |
*/ | |
function MODULENAME_schema_alter(&$schema) { | |
if (isset($schema['views_arg_cache_index_arguments'])) { | |
$schema['views_arg_cache_index_arguments']['fields']['aid']['size'] = 'big'; | |
} | |
} | |
/** | |
* Increase the size of the `views_arg_cache_index_arguments.aid` column. | |
*/ | |
function MODULENAME_update_7001() { | |
if (module_exists('views_arg_cache_index')) { | |
// Flush all Views Arg Cache Index views and tables. | |
$query = db_select('views_arg_cache_index', 'v') | |
->fields('v', array('cid')) | |
->execute(); | |
$cids = $query->fetchAllAssoc('cid'); | |
cache_clear_all(array_keys($cids), VIEWS_ARG_CACHE_INDEX_CACHE_TABLE, TRUE); | |
db_truncate('views_arg_cache_index')->execute(); | |
db_truncate('views_arg_cache_index_arguments')->execute(); | |
$schema = drupal_get_schema('views_arg_cache_index_arguments'); | |
$schema['fields']['aid']['size'] = 'big'; | |
db_change_field('views_arg_cache_index_arguments', 'aid', 'aid', $schema['fields']['aid']); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment