You are here

function commerce_uuid_uninstall in Commerce UUID 7

Implements hook_uninstall().

File

./commerce_uuid.install, line 135

Code

function commerce_uuid_uninstall() {

  // Remove the uuid column for the commerce_bundle_item entity type.
  if (module_exists('commerce_bundle_item')) {
    if (db_table_exists('commerce_bundle_item')) {
      if (!db_field_exists('commerce_bundle_item', 'uuid')) {
        db_drop_field('commerce_bundle_item', 'uuid', $field);
        db_drop_index('commerce_bundle_item', 'uuid', array(
          'uuid',
        ));
      }
    }
  }

  // Remove the uuid column for the commerce_customer_profile entity type.
  if (db_table_exists('commerce_customer_profile')) {
    if (db_field_exists('commerce_customer_profile', 'uuid')) {
      db_drop_field('commerce_customer_profile', 'uuid');
      db_drop_index('commerce_customer_profile', 'uuid');
    }
    if (db_field_exists('commerce_customer_profile_revision', 'vuuid')) {
      db_drop_field('commerce_customer_profile_revision', 'vuuid');
      db_drop_index('commerce_customer_profile_revision', 'vuuid');
    }
  }

  // Remove the uuid column for the commerce_line_item entity type.
  if (db_table_exists('commerce_line_item')) {
    if (db_field_exists('commerce_line_item', 'uuid')) {
      db_drop_field('commerce_line_item', 'uuid');
      db_drop_index('commerce_line_item', 'uuid');
    }
  }

  // Remove the uuid column for the commerce_order entity type.
  if (db_table_exists('commerce_order')) {
    if (db_field_exists('commerce_order', 'uuid')) {
      db_drop_field('commerce_order', 'uuid');
      db_drop_index('commerce_order', 'uuid');
    }
    if (db_field_exists('commerce_order_revision', 'vuuid')) {
      db_drop_field('commerce_order_revision', 'vuuid');
      db_drop_index('commerce_order_revision', 'vuuid');
    }
  }

  // Remove the uuid column for the commerce_payment_transaction entity type.
  if (db_table_exists('commerce_payment_transaction')) {
    if (db_field_exists('commerce_payment_transaction', 'uuid')) {
      db_drop_field('commerce_payment_transaction', 'uuid');
      db_drop_index('commerce_payment_transaction', 'uuid');
    }
    if (db_field_exists('commerce_payment_transaction_revision', 'vuuid')) {
      db_drop_field('commerce_payment_transaction_revision', 'vuuid');
      db_drop_index('commerce_payment_transaction_revision', 'vuuid');
    }
  }

  // Remove the uuid column for the commerce_product entity type.
  if (db_table_exists('commerce_product')) {
    if (db_field_exists('commerce_product', 'uuid')) {
      db_drop_field('commerce_product', 'uuid');
      db_drop_index('commerce_product', 'uuid');
    }
    if (db_field_exists('commerce_product_revision', 'vuuid')) {
      db_drop_field('commerce_product_revision', 'vuuid');
      db_drop_index('commerce_product_revision', 'vuuid');
    }
  }
}