diff --git a/domain.install b/domain.install
index 1f79b66..5c494e1 100644
--- a/domain.install
+++ b/domain.install
@@ -19,7 +19,7 @@ function domain_schema() {
   $schema['domain'] = array(
     'description' => 'The base table for domain records',
     'fields' => array(
-      'domain_id' => array('type' => 'serial', 'not null' => TRUE, 'description' => 'Primary key'),
+      'domain_id' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'description' => 'Primary key'),
       'subdomain' => array('type' => 'varchar', 'length' => '255', 'not null' => TRUE, 'default' => '', 'description' => 'Registered DNS entry, will match HTTP_HOST requests'),
       'sitename' => array('type' => 'varchar', 'length' => '255', 'not null' => TRUE, 'default' => '', 'description' => 'Site display name'),
       'scheme' => array('type' => 'varchar', 'length' => '8', 'not null' => TRUE, 'default' => 'http', 'description' => 'Protocol'),
@@ -32,6 +32,9 @@ function domain_schema() {
       'weight' => array('weight'),
       'is_default' => array('is_default'),
     ),
+    'foreign_keys' => array(
+      'domain_id' => array('domain_export' => 'domain_id'),
+    ),
   );
   $schema['domain_access'] = array(
     'description' => 'Stores domain information for each node',
@@ -58,6 +61,35 @@ function domain_schema() {
       'domain_id' => array('domain' => 'domain_id'),
     ),
   );
+  $schema['domain_export'] = array(
+    'description' => 'Stores canonical machine names for domains.',
+    'fields' => array(
+      'domain_id' => array('type' => 'serial', 'description' => 'Domain id. Automatic master key.'),
+      'machine_name' => array('type' => 'varchar', 'length' => '255', 'not null' => TRUE, 'default' => '', 'description' => 'The machine name for this domain.'),
+      'status' => array('type' => 'int', 'size' => 'tiny', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'description' => 'Stores whether domain is loaded from code.')),
+    'primary key' => array('machine_name'),
+    'indexes' => array(
+      'domain_id' => array('domain_id')
+    ),
+    'export' => array(
+      'identifier' => 'domain',
+      'bulk export' => TRUE,
+      'primary key' => 'machine_name',
+      'default hook' => 'domain_default_domains',
+      'admin_title' => 'sitename',
+      'admin_description' => 'subdomain',
+      'object' => 'domain',
+      // the callback to load the displays
+      'subrecords callback' => 'domain_load_machine_name',
+      // the variable that holds enabled/disabled status
+      'status' => 'domain_export_status',
+      // CRUD callbacks
+      'create callback' => 'domain_create_domain',
+      'save callback' => 'domain_save',
+      'delete callback' => 'domain_delete',
+      'export callback' => 'domain_export_domain',
+    ),
+  );
   return $schema;
 }
 
@@ -105,7 +137,7 @@ function domain_uninstall() {
 /**
  * Update block deltas to Drupal 7.
  */
-function domain_update_7000() {
+function domain_update_7000(&$sandbox) {
   // Get an array of the renamed block deltas, organized by module.
   $renamed_deltas = array(
     'domain' => array(
@@ -120,7 +152,7 @@ function domain_update_7000() {
 /**
  * Change the edit and delete permissions.
  */
-function domain_update_7001() {
+function domain_update_7001(&$sandbox) {
   db_update('role_permission')
     ->condition('permission', 'edit domain nodes')
     ->fields(array('permission' => 'edit domain content'))
@@ -135,7 +167,7 @@ function domain_update_7001() {
 /**
  * Add sorting to domains.
  */
-function domain_update_7300() {
+function domain_update_7300(&$sandbox) {
   if (db_field_exists('domain', 'weight')) {
     return('No update required');
   }
@@ -148,7 +180,7 @@ function domain_update_7300() {
 /**
  * Add default domain flag and weight the default higher.
  */
-function domain_update_7301() {
+function domain_update_7301(&$sandbox) {
   if (db_field_exists('domain', 'is_default')) {
     return('No update required');
   }
@@ -164,7 +196,7 @@ function domain_update_7301() {
 /**
  * Add an index on {domain}.is_default.
  */
-function domain_update_7302() {
+function domain_update_7302(&$sandbox) {
   if (!db_index_exists('domain', 'is_default')) {
     db_add_index('domain', 'is_default', array('is_default'));
   }
@@ -173,7 +205,7 @@ function domain_update_7302() {
 /**
  * Remove the zero record from the database.
  */
-function domain_update_7303() {
+function domain_update_7303(&$sandbox) {
   // We grab the default domain, remove it from the database, and
   // then re-save it into the table, using the new value as the default domain.
   $default = db_query("SELECT * FROM {domain} WHERE domain_id = 0")->fetchAssoc();
@@ -214,3 +246,53 @@ function domain_update_7303() {
   // Update message.
   return t('Domain Access updated successfully');
 }
+
+/**
+ * Allow domains to be made exportable.
+ */
+function domain_update_7304(&$sandbox) {
+  if (db_table_exists('domain_export')) {
+    return t('{domain_export} table exists.');
+  }
+  $schema = array(
+    'description' => 'Stores canonical machine names for domains.',
+    'fields' => array(
+      'domain_id' => array('type' => 'serial', 'description' => 'Domain id. Automatic master key.'),
+      'machine_name' => array('type' => 'varchar', 'length' => '255', 'not null' => TRUE, 'default' => '', 'description' => 'The machine name for this domain.'),
+      'status' => array('type' => 'int', 'size' => 'tiny', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'description' => 'Stores whether domain is loaded from code.')),
+    'primary key' => array('machine_name'),
+    'indexes' => array(
+      'domain_id' => array('domain_id')
+    ),
+  );
+  db_create_table('domain_export', $schema);
+  return t('{domain_export} table created.');
+}
+
+/**
+ * Insert existing domain records into {domain_export}.
+ */
+function domain_update_7305(&$sandbox) {
+  $domains = db_query("SELECT domain_id, subdomain FROM {domain} ORDER BY domain_id")->fetchAll();
+  foreach ($domains as $domain) {
+    $query = db_insert('domain_export')
+      ->fields(array(
+        'domain_id' => $domain->domain_id,
+        'machine_name' => $domain->subdomain,
+        'status' => 0,
+      ));
+    $query->execute();
+  }
+  return t('{domain_export} table populated.');
+}
+
+/**
+ * Rebuild the {domain} table.
+ */
+function domain_update_7306(&$sandbox) {
+  db_drop_index('domain', 'domain_id');
+  $spec = array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'description' => 'Primary key');
+  db_change_field('domain', 'domain_id', 'domain_id', $spec);
+  db_add_index('domain', 'domain_id', array('domain_id'));
+  return t('{domain} table updated.');
+}
