diff --git a/ldapauth.install b/ldapauth.install
index 32972f0..890d593 100644
--- a/ldapauth.install
+++ b/ldapauth.install
@@ -112,8 +112,21 @@ function ldapauth_schema() {
         'default' => 0,
       ),
     ),
-    'primary key' => array('sid'),
-    'unique keys' => array('name' => array('name')),
+		'primary key' => array('sid'),
+		'unique keys' => array('name' => array('name')),
+		'export' => array(
+			'key' => 'name',
+			'key name' => 'Name',
+			'primary key' => 'sid',
+			'identifier' => 'ldapauth_server',
+			'default hook' => 'default_ldapauth_server',
+			'api' => array(
+				'owner' => 'ldapauth',
+				'api' => 'default_ldapauth_servers',
+				'minimum_version' => 1,
+				'current_version' => 1,
+      ),
+    ),
   );
   return $schema;
 }
diff --git a/ldapdata.install b/ldapdata.install
index 2e23859..215659d 100644
--- a/ldapdata.install
+++ b/ldapdata.install
@@ -16,34 +16,11 @@ function ldapdata_install() {
   // We're adding to an existing table, not creating a new one.
   $ret = array();
 
-  db_add_field($ret, 'ldapauth', 'ldapdata_binddn', array(
-    'type' => 'varchar',
-    'length' => 255,
-  ));
-  db_add_field($ret, 'ldapauth', 'ldapdata_bindpw', array(
-    'type' => 'varchar',
-    'length' => 255,
-  ));
-  db_add_field($ret, 'ldapauth', 'ldapdata_rwattrs', array(
-    'type' => 'text',
-    'not null' => FALSE,
-  ));
-  db_add_field($ret, 'ldapauth', 'ldapdata_roattrs', array(
-    'type' => 'text',
-    'not null' => FALSE,
-  ));
-  db_add_field($ret, 'ldapauth', 'ldapdata_mappings', array(
-    'type' => 'text',
-    'not null' => FALSE,
-  ));
-  db_add_field($ret, 'ldapauth', 'ldapdata_attrs', array(
-    'type' => 'text',
-    'not null' => FALSE,
-  ));
-  db_add_field($ret, 'ldapauth', 'ldapdata_filter_php', array(
-    'type' => 'text',
-    'not null' => FALSE,
-  ));
+	$schema['ldapauth'] = array('fields' => array());
+	ldapdata_schema_alter($schema);
+	foreach ($schema['ldapauth']['fields'] as $name => $spec) {
+		db_add_field($ret, 'ldapauth', $name, $spec);
+	}
 
   return $ret;
 }
@@ -55,13 +32,11 @@ function ldapdata_uninstall() {
   // We're removing fileds from an existing table, not deleting a whole one.
   $ret = array();
 
-  db_drop_field($ret, 'ldapauth', 'ldapdata_binddn');
-  db_drop_field($ret, 'ldapauth', 'ldapdata_bindpw');
-  db_drop_field($ret, 'ldapauth', 'ldapdata_rwattrs');
-  db_drop_field($ret, 'ldapauth', 'ldapdata_roattrs');
-  db_drop_field($ret, 'ldapauth', 'ldapdata_mappings');
-  db_drop_field($ret, 'ldapauth', 'ldapdata_attrs');
-  db_drop_field($ret, 'ldapauth', 'ldapdata_filter_php');
+	$schema['ldapauth'] = array('fields' => array());
+	ldapdata_schema_alter($schema);
+	foreach ($schema['ldapauth']['fields'] as $name => $spec) {
+		db_drop_field($ret, 'ldapauth', $name);
+	}
 
   // Remove variables
   variable_del('ldapdata_sync');
@@ -69,16 +44,58 @@ function ldapdata_uninstall() {
   return $ret;
 }
 
+/**
+ * Implementation of hook_schema_alter().
+ */
+function ldapdata_schema_alter(&$schema) {
+	if (isset($schema['ldapauth'])) {
+		$schema['ldapauth']['fields'] += array(
+			'ldapdata_binddn' => array(
+				'type' => 'varchar',
+				'length' => 255,
+			),
+			'ldapdata_bindpw' => array(
+				'type' => 'varchar',
+				'length' => 255,
+			),
+			'ldapdata_rwattrs' => array(
+				'type' => 'text',
+				'not null' => FALSE,
+			),
+			'ldapdata_roattrs' => array(
+				'type' => 'text',
+				'not null' => FALSE,
+			),
+			'ldapdata_mappings' => array(
+				'type' => 'text',
+				'not null' => FALSE,
+			),
+			'ldapdata_attrs' => array(
+				'type' => 'text',
+				'not null' => FALSE,
+			),
+			'ldapdata_filter_php' => array(
+				'type' => 'text',
+				'not null' => FALSE,
+			),
+		);
+	}
+}
+
+
 function ldapdata_update_6001() {
   $ret = array();
-  db_add_field($ret, 'ldapauth', 'ldapdata_attrs', array(
-    'type' => 'text',
-    'not null' => FALSE,
-  ));
-  db_add_field($ret, 'ldapauth', 'ldapdata_filter_php', array(
-    'type' => 'text',
-    'not null' => FALSE,
-  ));
+	$new_fields = array(
+		'ldapdata_attrs',
+		'ldapdata_filter_php',
+	);
+
+	$schema['ldapauth'] = array('fields' => array());
+  ldapdata_schema_alter($schema);
+  foreach ($new_fields as $name) {
+    db_add_field($ret, 'ldapauth', $name, $schema['ldapauth']['fields'][$name]);
+  }
+	
   return $ret;
 }
 
diff --git a/ldapgroups.install b/ldapgroups.install
index 02df8b1..9c8d3dc 100644
--- a/ldapgroups.install
+++ b/ldapgroups.install
@@ -16,57 +16,11 @@ function ldapgroups_install() {
   // We're adding to an existing table, not creating a new one.
   $ret = array();
 
-  db_add_field($ret, 'ldapauth', 'ldapgroups_in_dn', array(
-    'type' => 'int',
-    'size' => 'tiny',
-    'not null' => TRUE,
-    'default' => '0',
-  ));
-  db_add_field($ret, 'ldapauth', 'ldapgroups_dn_attribute', array(
-    'type' => 'varchar',
-    'length' => 255,
-  ));
-  db_add_field($ret, 'ldapauth', 'ldapgroups_attr', array(
-    'type' => 'varchar',
-    'length' => 255,
-  ));
-  db_add_field($ret, 'ldapauth', 'ldapgroups_in_attr', array(
-    'type' => 'int',
-    'size' => 'tiny',
-    'not null' => TRUE,
-    'default' => '0',
-  ));
-  db_add_field($ret, 'ldapauth', 'ldapgroups_as_entries', array(
-    'type' => 'int',
-    'size' => 'tiny',
-    'not null' => TRUE,
-    'default' => '0',
-  ));
-  db_add_field($ret, 'ldapauth', 'ldapgroups_entries', array(
-    'type' => 'text',
-  ));
-  db_add_field($ret, 'ldapauth', 'ldapgroups_entries_attribute',  array(
-    'type' => 'varchar',
-    'length' => 255,
-  ));
-  db_add_field($ret, 'ldapauth', 'ldapgroups_mappings',  array(
-    'type' => 'text',
-    'not null' => FALSE,
-  ));
-  db_add_field($ret, 'ldapauth', 'ldapgroups_mappings_filter', array(
-    'type' => 'int',
-    'size' => 'tiny',
-    'not null' => TRUE,
-    'default' => '0',
-  ));
-  db_add_field($ret, 'ldapauth', 'ldapgroups_filter_php',  array(
-    'type' => 'text',
-    'not null' => FALSE,
-  ));
-  db_add_field($ret, 'ldapauth', 'ldapgroups_groups',  array(
-    'type' => 'text',
-    'not null' => FALSE,
-  ));
+  $schema['ldapauth'] = array('fields' => array());
+  ldapgroups_schema_alter($schema);
+  foreach ($schema['ldapauth']['fields'] as $name => $spec) {
+    db_add_field($ret, 'ldapauth', $name, $spec);
+  }
 
   return $ret;
 }
@@ -78,41 +32,90 @@ function ldapgroups_uninstall() {
   // We're removing fileds from an existing table, not deleting a whole one.
   $ret = array();
 
-  db_drop_field($ret, 'ldapauth', 'ldapgroups_in_dn');
-  db_drop_field($ret, 'ldapauth', 'ldapgroups_dn_attribute');
-  db_drop_field($ret, 'ldapauth', 'ldapgroups_attr');
-  db_drop_field($ret, 'ldapauth', 'ldapgroups_in_attr');
-  db_drop_field($ret, 'ldapauth', 'ldapgroups_as_entries');
-  db_drop_field($ret, 'ldapauth', 'ldapgroups_entries');
-  db_drop_field($ret, 'ldapauth', 'ldapgroups_entries_attribute');
-  db_drop_field($ret, 'ldapauth', 'ldapgroups_mappings');
-  db_drop_field($ret, 'ldapauth', 'ldapgroups_mappings_filter');
-  db_drop_field($ret, 'ldapauth', 'ldapgroups_filter_php');
-  db_drop_field($ret, 'ldapauth', 'ldapgroups_groups');
+  $schema['ldapauth'] = array('fields' => array());
+  ldapgroups_schema_alter($schema);
+  foreach ($schema['ldapauth']['fields'] as $name => $spec) {
+    db_drop_field($ret, 'ldapauth', $name);
+  }
 
   return $ret;
 }
 
+/**
+ * Implementation of hook_schema_alter().
+ */
+function ldapgroups_schema_alter(&$schema) {
+	if (isset($schema['ldapauth'])) {
+		$schema['ldapauth']['fields'] += array(
+			'ldapgroups_in_dn' => array(
+				'type' => 'int',
+				'size' => 'tiny',
+				'not null' => TRUE,
+				'default' => '0',
+			),
+			'ldapgroups_dn_attribute' => array(
+				'type' => 'varchar',
+				'length' => 255,
+			),
+			'ldapgroups_attr' => array(
+				'type' => 'varchar',
+				'length' => 255,
+			),
+			'ldapgroups_in_attr' => array(
+				'type' => 'int',
+				'size' => 'tiny',
+				'not null' => TRUE,
+				'default' => '0',
+			),
+			'ldapgroups_as_entries' => array(
+				'type' => 'int',
+				'size' => 'tiny',
+				'not null' => TRUE,
+				'default' => '0',
+			),
+			'ldapgroups_entries' => array(
+				'type' => 'text',
+			),
+			'ldapgroups_entries_attribute' => array(
+				'type' => 'varchar',
+				'length' => 255,
+			),
+			'ldapgroups_mappings' =>  array(
+				'type' => 'text',
+				'not null' => FALSE,
+			),
+			'ldapgroups_mappings_filter' => array(
+				'type' => 'int',
+				'size' => 'tiny',
+				'not null' => TRUE,
+				'default' => '0',
+			),
+			'ldapgroups_filter_php' => array(
+				'type' => 'text',
+				'not null' => FALSE,
+			),
+			'ldapgroups_groups' => array(
+				'type' => 'text',
+				'not null' => FALSE,
+			),
+		);
+	}
+}
+
 function ldapgroups_update_6001() {
-  $ret = array();
-  db_add_field($ret, 'ldapauth', 'ldapgroups_mappings',  array(
-    'type' => 'text',
-    'not null' => FALSE,
-  ));
-  db_add_field($ret, 'ldapauth', 'ldapgroups_mappings_filter', array(
-    'type' => 'int',
-    'size' => 'tiny',
-    'not null' => TRUE,
-    'default' => '0',
-  ));
-  db_add_field($ret, 'ldapauth', 'ldapgroups_filter_php',  array(
-    'type' => 'text',
-    'not null' => FALSE,
-  ));
-  db_add_field($ret, 'ldapauth', 'ldapgroups_groups',  array(
-    'type' => 'text',
-    'not null' => FALSE,
-  ));
+	$ret = array();
+	$new_fields = array(
+		'ldapgroups_mappings',
+		'ldapgroups_mappings_filter',
+		'ldapgroups_filter_php',
+		'ldapgroups_groups'
+	);
+
+	$schema['ldapauth'] = array('fields' => array());
+  ldapgroups_schema_alter($schema);
+  foreach ($new_fields as $name) {
+    db_add_field($ret, 'ldapauth', $name, $schema['ldapauth']['fields'][$name]);
+  }
+
   return $ret;
 }
-
