Index: openlayers.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/openlayers/openlayers.install,v
retrieving revision 1.12.2.2
diff -u -p -r1.12.2.2 openlayers.install
--- openlayers.install	26 Sep 2009 22:10:45 -0000	1.12.2.2
+++ openlayers.install	26 Jan 2010 16:16:54 -0000
@@ -180,39 +180,51 @@ function openlayers_schema() {
 }
 
 /**
- * Implementation of hook_update_n()
- *
- * Updates OpenLayers from 6-1.x to 6-2.x
+ * Set variable to prevent the schema upgrade that follows.
+ */
+function openlayers_update_6003() {
+  // Upgrading from 0.x does not require a schema upgrade. Setting this to TRUE
+  // will prevent the upgrade from happening.
+  variable_set('openlayers_avoid_schema_upgrade', TRUE);
+  return array();
+}
+
+/**
+ * Update to new schema.
  */
 function openlayers_update_6200() {
   $ret = array();
 
-  // Alter presets table.
-  db_drop_field($ret, 'openlayers_map_presets', 'preset_id');
-  db_change_field($ret, 'openlayers_map_presets', 'preset_name', 'name',
-    array('type' => 'varchar', 'length' => 255, 'not null' => TRUE),
-    array('primary key' => array('name'))
-  );
-  db_change_field($ret, 'openlayers_map_presets', 'preset_title', 'title',
-    array('type' => 'varchar', 'length' => 255, 'not null' => TRUE),
-    array()
-  );
-  db_change_field($ret, 'openlayers_map_presets', 'preset_description', 'description',
-    array('type' => 'text', 'not null' => TRUE),
-    array()
-  );
-  db_change_field($ret, 'openlayers_map_presets', 'preset_data', 'data',
-    array('type' => 'text', 'not null' => TRUE),
-    array()
-  );
+  if (!variable_get('openlayers_avoid_schema_upgrade', FALSE)) {
+    // Alter presets table.
+    db_drop_field($ret, 'openlayers_map_presets', 'preset_id');
+    db_change_field($ret, 'openlayers_map_presets', 'preset_name', 'name',
+      array('type' => 'varchar', 'length' => 255, 'not null' => TRUE),
+      array('primary key' => array('name'))
+    );
+    db_change_field($ret, 'openlayers_map_presets', 'preset_title', 'title',
+      array('type' => 'varchar', 'length' => 255, 'not null' => TRUE),
+      array()
+    );
+    db_change_field($ret, 'openlayers_map_presets', 'preset_description', 'description',
+      array('type' => 'text', 'not null' => TRUE),
+      array()
+    );
+    db_change_field($ret, 'openlayers_map_presets', 'preset_data', 'data',
+      array('type' => 'text', 'not null' => TRUE),
+      array()
+    );
 
-  // Ensure that all tables are installed
-  $schema = drupal_get_schema_unprocessed('openlayers');
-  foreach ($schema as $name => $table) {
-    if (!db_table_exists($name)) {
-      db_create_table($ret, $name, $table);
+    // Ensure that all tables are installed
+    $schema = drupal_get_schema_unprocessed('openlayers');
+    foreach ($schema as $name => $table) {
+      if (!db_table_exists($name)) {
+        db_create_table($ret, $name, $table);
+      }
     }
   }
 
+  variable_del('openlayers_avoid_schema_upgrade');
+
   return $ret;
 }
