summaryrefslogtreecommitdiffstats
path: root/migrate.module
diff options
context:
space:
mode:
authorMike Ryan2009-08-18 20:54:09 +0000
committerMike Ryan2009-08-18 20:54:09 +0000
commite0ef7d4e7079058bad1568948071b70a0b25f9de (patch)
treeb2c401925d51aac1540d6b978c1582dae835be02 /migrate.module
parent7933237625fd6795382cd5a6c3cc2b108e6072bc (diff)
#550874 by mikeryan: Must clear schema cache for map to be updated on import
Diffstat (limited to 'migrate.module')
-rwxr-xr-xmigrate.module11
1 files changed, 11 insertions, 0 deletions
diff --git a/migrate.module b/migrate.module
index 0c20b1b..85fb829 100755
--- a/migrate.module
+++ b/migrate.module
@@ -133,6 +133,8 @@ function migrate_save_content_set(&$content_set, $options = array()) {
$sourcefield['type'] = 'int';
}
+ $schema_change = FALSE;
+
if (!db_table_exists($maptablename)) {
$schema = _migrate_map_table_schema($sourcefield);
db_create_table($ret, $maptablename, $schema);
@@ -145,6 +147,7 @@ function migrate_save_content_set(&$content_set, $options = array()) {
// Expose messages table to views
tw_add_tables(array($msgtablename));
tw_add_fk($msgtablename, 'sourceid');
+ $schema_change = TRUE;
}
else {
// TODO: Deal with varchar->int case where there is existing non-int data
@@ -155,6 +158,8 @@ function migrate_save_content_set(&$content_set, $options = array()) {
db_drop_primary_key($ret, $maptablename);
db_change_field($ret, $maptablename, 'sourceid', 'sourceid',
$sourcefield, array('primary key' => array('sourceid')));
+ tw_perform_analysis($maptablename);
+ $schema_change = TRUE;
}
$desired_schema = _migrate_message_table_schema($sourcefield);
$actual_schema = $inspect[$msgtablename];
@@ -163,8 +168,14 @@ function migrate_save_content_set(&$content_set, $options = array()) {
db_drop_index($ret, $msgtablename, 'sourceid');
db_change_field($ret, $msgtablename, 'sourceid', 'sourceid',
$sourcefield, array('indexes' => array('sourceid' => array('sourceid'))));
+ tw_perform_analysis($maptablename);
+ $schema_change = TRUE;
}
}
+ // Make sure the schema gets updated to reflect changes
+ if ($schema_change) {
+ cache_clear_all('schema', 'cache');
+ }
}
if ($was_array) {