问题
I recently ran the database repair tool as per this link: http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/db-repair-tool
At the bottom of the instructions, it says “Added missing foreign key or field (or even a table!) — major/fatal issue. Ask a developer for help.” It seems to me like i have lots of major fatal issues. I had been having problems that led me to run the database repair. Explanations of those problems can be found at the following Stack Overflow questions:
Magento - Registration problem - User is sent to My Cart after entering billing information
Magento - Registration error - 1054 Unknown column 'ca.sort_order' in 'order clause'
Is this a serious problem? The repair I ran was on a clone of my current database - is it safe to run this repair on my original database? Is my setup just borked? Please help!
Add missing field(s) "multiline_count, validate_rules, is_system, sort_order" to table "customer_eav_attribute"
Add missing field(s) "ideal_issuer_id, ideal_issuer_list" to table "sales_flat_quote_payment"
Add missing foreign key(s) "FK_BUNDLE_PRICE_SELECTION_WEBSITE, FK_BUNDLE_PRICE_SELECTION_ID" to table "catalog_product_bundle_selection_price"
Add missing foreign key(s) "FK_CUSTOMER_FORM_ATTRIBUTE_ATTRIBUTE" to table "customer_form_attribute"
Add missing foreign key(s) "FK_EAV_ENTITY_ATTRIBUTE_ATTRIBUTE, FK_EAV_ENTITY_ATTRIBUTE_GROUP" to table "eav_entity_attribute"
Add missing foreign key(s) "FK_EAV_ENTITY_DATETIME_ENTITY, FK_EAV_ENTITY_DATETIME_ENTITY_TYPE, FK_EAV_ENTITY_DATETIME_STORE" to table "eav_entity_datetime"
Add missing foreign key(s) "FK_EAV_ENTITY_DECIMAL_ENTITY, FK_EAV_ENTITY_DECIMAL_ENTITY_TYPE, FK_EAV_ENTITY_DECIMAL_STORE" to table "eav_entity_decimal"
Add missing foreign key(s) "FK_EAV_ENTITY_INT_ENTITY, FK_EAV_ENTITY_INT_ENTITY_TYPE, FK_EAV_ENTITY_INT_STORE" to table "eav_entity_int"
Add missing foreign key(s) "FK_EAV_ENTITY_STORE_ENTITY_TYPE, FK_EAV_ENTITY_STORE_STORE" to table "eav_entity_store"
Add missing foreign key(s) "FK_EAV_ENTITY_TEXT_ENTITY, FK_EAV_ENTITY_TEXT_ENTITY_TYPE, FK_EAV_ENTITY_TEXT_STORE" to table "eav_entity_text"
Add missing foreign key(s) "FK_EAV_ENTITY_VARCHAR_ENTITY, FK_EAV_ENTITY_VARCHAR_ENTITY_TYPE, FK_EAV_ENTITY_VARCHAR_STORE" to table "eav_entity_varchar"
Add missing foreign key(s) "FK_EAV_FORM_ELEMENT_FORM_TYPE, FK_EAV_FORM_ELEMENT_FORM_FIELDSET, FK_EAV_FORM_ELEMENT_ATTRIBUTE" to table "eav_form_element"
Add missing foreign key(s) "FK_EAV_FORM_FIELDSET_FORM_TYPE" to table "eav_form_fieldset"
Add missing foreign key(s) "FK_EAV_FORM_FIELDSET_LABEL_FORM_FIELDSET, FK_EAV_FORM_FIELDSET_LABEL_STORE" to table "eav_form_fieldset_label"
Add missing foreign key(s) "FK_EAV_FORM_TYPE_STORE" to table "eav_form_type"
Add missing foreign key(s) "FK_EAV_FORM_TYPE_ENTITY_ENTITY_TYPE, FK_EAV_FORM_TYPE_ENTITY_FORM_TYPE" to table "eav_form_type_entity"
Add missing foreign key(s) "GOOGLEBASE_ATTRIBUTES_ATTRIBUTE_ID, GOOGLEBASE_ATTRIBUTES_TYPE_ID" to table "googlebase_attributes"
Add missing foreign key(s) "GOOGLEBASE_ITEMS_PRODUCT_ID, GOOGLEBASE_ITEMS_STORE_ID" to table "googlebase_items"
Add missing foreign key(s) "GOOGLEBASE_TYPES_ATTRIBUTE_SET_ID" to table "googlebase_types"
Add missing foreign key(s) "FK_GOOGLEOPTIMIZER_CODE_STORE" to table "googleoptimizer_code"
Add missing foreign key(s) "FK_INDEX_EVNT_PROCESS, FK_INDEX_PROCESS_EVENT" to table "index_process_event"
Add missing foreign key(s) "FK_PROBLEM_QUEUE, FK_PROBLEM_SUBSCRIBER" to table "newsletter_problem"
Add missing foreign key(s) "FK_QUEUE_TEMPLATE" to table "newsletter_queue"
Add missing foreign key(s) "FK_QUEUE_LINK_QUEUE, FK_QUEUE_LINK_SUBSCRIBER" to table "newsletter_queue_link"
Add missing foreign key(s) "FK_NEWSLETTER_QUEUE_STORE_LINK_STORE, FK_LINK_QUEUE" to table "newsletter_queue_store_link"
Add missing foreign key(s) "FK_NEWSLETTER_SUBSCRIBER_STORE" to table "newsletter_subscriber"
Add missing foreign key(s) "FK_PAYPAL_CERT_WEBSITE" to table "paypal_cert"
Add missing foreign key(s) "FK_PAYPAL_SETTLEMENT_ROW_REPORT" to table "paypal_settlement_report_row"
Add missing foreign key(s) "FK_POLL_STORE" to table "poll"
Add missing foreign key(s) "FK_POLL_PARENT" to table "poll_answer"
Add missing foreign key(s) "FK_POLL_STORE_STORE, FK_POLL_STORE_POLL" to table "poll_store"
Add missing foreign key(s) "FK_POLL_ANSWER" to table "poll_vote"
Add missing foreign key(s) "FK_PRODUCT_ALERT_PRICE_CUSTOMER, FK_PRODUCT_ALERT_PRICE_PRODUCT, FK_PRODUCT_ALERT_PRICE_WEBSITE" to table "product_alert_price"
Add missing foreign key(s) "FK_PRODUCT_ALERT_STOCK_WEBSITE, FK_PRODUCT_ALERT_STOCK_CUSTOMER, FK_PRODUCT_ALERT_STOCK_PRODUCT" to table "product_alert_stock"
Add missing foreign key(s) "FK_RATING_ENTITY_KEY" to table "rating"
Add missing foreign key(s) "FK_RATING_OPTION_RATING" to table "rating_option"
Add missing foreign key(s) "FK_RATING_OPTION_REVIEW_ID, FK_RATING_OPTION_VALUE_OPTION" to table "rating_option_vote"
Add missing foreign key(s) "FK_RATING_OPTION_VALUE_AGGREGATE, FK_RATING_OPTION_VOTE_AGGREGATED_STORE" to table "rating_option_vote_aggregated"
Add missing foreign key(s) "FK_RATING_STORE_STORE, FK_RATING_STORE_RATING" to table "rating_store"
Add missing foreign key(s) "FK_RATING_TITLE, FK_RATING_TITLE_STORE" to table "rating_title"
Add missing foreign key(s) "FK_REPORT_COMPARED_PRODUCT_INDEX_CUSTOMER, FK_REPORT_COMPARED_PRODUCT_INDEX_PRODUCT, FK_REPORT_COMPARED_PRODUCT_INDEX_STORE" to table "report_compared_product_index"
Add missing foreign key(s) "FK_REPORT_EVENT_STORE, FK_REPORT_EVENT_TYPE" to table "report_event"
Add missing foreign key(s) "FK_REPORT_VIEWED_PRODUCT_INDEX_CUSTOMER, FK_REPORT_VIEWED_PRODUCT_INDEX_PRODUCT, FK_REPORT_VIEWED_PRODUCT_INDEX_STORE" to table "report_viewed_product_index"
Add missing foreign key(s) "FK_REVIEW_ENTITY, FK_REVIEW_STATUS" to table "review"
Add missing foreign key(s) "FK_REVIEW_DETAIL_CUSTOMER, FK_REVIEW_DETAIL_REVIEW, FK_REVIEW_DETAIL_STORE" to table "review_detail"
Add missing foreign key(s) "FK_REVIEW_ENTITY_SUMMARY_STORE" to table "review_entity_summary"
Add missing foreign key(s) "FK_REVIEW_STORE_REVIEW, FK_REVIEW_STORE_STORE" to table "review_store"
Add missing foreign key(s) "FK_PRODUCT_ORDERED_AGGREGATED_DAILY_PRODUCT_ID, FK_PRODUCT_ORDERED_AGGREGATED_DAILY_STORE_ID" to table "sales_bestsellers_aggregated_daily"
Add missing foreign key(s) "FK_PRODUCT_ORDERED_AGGREGATED_MONTHLY_PRODUCT_ID, FK_PRODUCT_ORDERED_AGGREGATED_MONTHLY_STORE_ID" to table "sales_bestsellers_aggregated_monthly"
Add missing foreign key(s) "FK_PRODUCT_ORDERED_AGGREGATED_YEARLY_PRODUCT_ID, FK_PRODUCT_ORDERED_AGGREGATED_YEARLY_STORE_ID" to table "sales_bestsellers_aggregated_yearly"
Add missing foreign key(s) "FK_BILLING_AGREEMENT_CUSTOMER, FK_BILLING_AGREEMENT_STORE" to table "sales_billing_agreement"
Add missing foreign key(s) "FK_BILLING_AGREEMENT_ORDER_ORDER, FK_BILLING_AGREEMENT_ORDER_AGREEMENT" to table "sales_billing_agreement_order"
Add missing foreign key(s) "FK_SALES_FLAT_CREDITMEMO_PARENT, FK_SALES_FLAT_CREDITMEMO_STORE" to table "sales_flat_creditmemo"
Add missing foreign key(s) "FK_SALES_FLAT_CREDITMEMO_COMMENT_PARENT" to table "sales_flat_creditmemo_comment"
Add missing foreign key(s) "FK_SALES_FLAT_CREDITMEMO_GRID_PARENT, FK_SALES_FLAT_CREDITMEMO_GRID_STORE" to table "sales_flat_creditmemo_grid"
Add missing foreign key(s) "FK_SALES_FLAT_CREDITMEMO_ITEM_PARENT" to table "sales_flat_creditmemo_item"
Add missing foreign key(s) "FK_SALES_FLAT_INVOICE_PARENT, FK_SALES_FLAT_INVOICE_STORE" to table "sales_flat_invoice"
Add missing foreign key(s) "FK_SALES_FLAT_INVOICE_COMMENT_PARENT" to table "sales_flat_invoice_comment"
Add missing foreign key(s) "FK_SALES_FLAT_INVOICE_GRID_PARENT, FK_SALES_FLAT_INVOICE_GRID_STORE" to table "sales_flat_invoice_grid"
Add missing foreign key(s) "FK_SALES_FLAT_INVOICE_ITEM_PARENT" to table "sales_flat_invoice_item"
Add missing foreign key(s) "FK_SALES_FLAT_ORDER_CUSTOMER, FK_SALES_FLAT_ORDER_STORE" to table "sales_flat_order"
Add missing foreign key(s) "FK_SALES_FLAT_ORDER_ADDRESS_PARENT" to table "sales_flat_order_address"
Add missing foreign key(s) "FK_SALES_FLAT_ORDER_GRID_CUSTOMER, FK_SALES_FLAT_ORDER_GRID_PARENT, FK_SALES_FLAT_ORDER_GRID_STORE" to table "sales_flat_order_grid"
Add missing foreign key(s) "FK_SALES_FLAT_ORDER_ITEM_PARENT, FK_SALES_FLAT_ORDER_ITEM_STORE" to table "sales_flat_order_item"
Add missing foreign key(s) "FK_SALES_FLAT_ORDER_PAYMENT_PARENT" to table "sales_flat_order_payment"
Add missing foreign key(s) "FK_SALES_FLAT_ORDER_STATUS_HISTORY_PARENT" to table "sales_flat_order_status_history"
Add missing foreign key(s) "FK_SALES_QUOTE_STORE" to table "sales_flat_quote"
Add missing foreign key(s) "FK_SALES_QUOTE_ADDRESS_SALES_QUOTE" to table "sales_flat_quote_address"
Add missing foreign key(s) "FK_QUOTE_ADDRESS_ITEM_QUOTE_ADDRESS, FK_SALES_FLAT_QUOTE_ADDRESS_ITEM_PARENT, FK_SALES_QUOTE_ADDRESS_ITEM_QUOTE_ITEM" to table "sales_flat_quote_address_item"
Add missing foreign key(s) "FK_SALES_FLAT_QUOTE_ITEM_PARENT_ITEM, FK_SALES_QUOTE_ITEM_CATALOG_PRODUCT_ENTITY, FK_SALES_QUOTE_ITEM_SALES_QUOTE, FK_SALES_QUOTE_ITEM_STORE" to table "sales_flat_quote_item"
Add missing foreign key(s) "FK_SALES_QUOTE_ITEM_OPTION_ITEM_ID" to table "sales_flat_quote_item_option"
Add missing foreign key(s) "FK_SALES_QUOTE_PAYMENT_SALES_QUOTE" to table "sales_flat_quote_payment"
Add missing foreign key(s) "FK_SALES_QUOTE_SHIPPING_RATE_ADDRESS" to table "sales_flat_quote_shipping_rate"
Add missing foreign key(s) "FK_SALES_FLAT_SHIPMENT_PARENT, FK_SALES_FLAT_SHIPMENT_STORE" to table "sales_flat_shipment"
Add missing foreign key(s) "FK_SALES_FLAT_SHIPMENT_COMMENT_PARENT" to table "sales_flat_shipment_comment"
Add missing foreign key(s) "FK_SALES_FLAT_SHIPMENT_GRID_PARENT, FK_SALES_FLAT_SHIPMENT_GRID_STORE" to table "sales_flat_shipment_grid"
Add missing foreign key(s) "FK_SALES_FLAT_SHIPMENT_ITEM_PARENT" to table "sales_flat_shipment_item"
Add missing foreign key(s) "FK_SALES_FLAT_SHIPMENT_TRACK_PARENT" to table "sales_flat_shipment_track"
Add missing foreign key(s) "FK_SALES_INVOICED_AGGREGATED_STORE" to table "sales_invoiced_aggregated"
Add missing foreign key(s) "FK_SALES_INVOICED_AGGREGATED_ORDER_STORE" to table "sales_invoiced_aggregated_order"
Add missing foreign key(s) "FK_SALES_ORDER_AGGREGATED_CREATED" to table "sales_order_aggregated_created"
Add missing foreign key(s) "FK_SALES_ORDER_STATUS_LABEL_STATUS, FK_SALES_ORDER_STATUS_LABEL_STORE" to table "sales_order_status_label"
Add missing foreign key(s) "FK_SALES_ORDER_STATUS_STATE_STATUS" to table "sales_order_status_state"
Add missing foreign key(s) "FK_SALES_PAYMENT_TRANSACTION_ORDER, FK_SALES_PAYMENT_TRANSACTION_PARENT, FK_SALES_PAYMENT_TRANSACTION_PAYMENT" to table "sales_payment_transaction"
Add missing foreign key(s) "FK_RECURRING_PROFILE_STORE, FK_RECURRING_PROFILE_CUSTOMER" to table "sales_recurring_profile"
Add missing foreign key(s) "FK_RECURRING_PROFILE_ORDER_ORDER, FK_RECURRING_PROFILE_ORDER_PROFILE" to table "sales_recurring_profile_order"
Add missing foreign key(s) "FK_SALES_REFUNDED_AGGREGATED_STORE" to table "sales_refunded_aggregated"
Add missing foreign key(s) "FK_SALES_REFUNDED_AGGREGATED_ORDER_STORE" to table "sales_refunded_aggregated_order"
Add missing foreign key(s) "FK_SALES_SHIPPING_AGGREGATED_STORE" to table "sales_shipping_aggregated"
Add missing foreign key(s) "FK_SALES_SHIPPING_AGGREGATED_ORDER_STORE" to table "sales_shipping_aggregated_order"
Add missing foreign key(s) "FK_SALESRULE_COUPON_RULE_ID_SALESRULE" to table "salesrule_coupon"
Add missing foreign key(s) "FK_SALESRULE_CPN_CUST_CUST_ID_CUST_ENTITY, FK_SALESRULE_CPN_CUST_CPN_ID_CUST_ENTITY" to table "salesrule_coupon_usage"
Add missing foreign key(s) "FK_SALESRULE_CUSTOMER_ID, FK_SALESRULE_CUSTOMER_RULE" to table "salesrule_customer"
Add missing foreign key(s) "FK_SALESRULE_LABEL_RULE, FK_SALESRULE_LABEL_STORE" to table "salesrule_label"
Add missing foreign key(s) "FK_SALESRULE_PRODUCT_ATTRIBUTE_ATTRIBUTE, FK_SALESRULE_PRODUCT_ATTRIBUTE_CUSTOMER_GROUP, FK_SALESRULE_PRODUCT_ATTRIBUTE_RULE, FK_SALESRULE_PRODUCT_ATTRIBUTE_WEBSITE" to table "salesrule_product_attribute"
Add missing foreign key(s) "FK_SITEMAP_STORE" to table "sitemap"
Add missing foreign key(s) "FK_TAG_PROPERTIES_STORE, FK_TAG_PROPERTIES_TAG" to table "tag_properties"
Add missing foreign key(s) "FK_TAG_RELATION_CUSTOMER, FK_TAG_RELATION_PRODUCT, FK_TAG_RELATION_STORE, FK_TAG_RELATION_TAG" to table "tag_relation"
Add missing foreign key(s) "FK_TAG_SUMMARY_STORE, FK_TAG_SUMMARY_TAG" to table "tag_summary"
Add missing foreign key(s) "FK_TAX_CALCULATION_PTC, FK_TAX_CALCULATION_CTC, FK_TAX_CALCULATION_RATE, FK_TAX_CALCULATION_RULE" to table "tax_calculation"
Add missing foreign key(s) "FK_TAX_CALCULATION_RATE_TITLE_STORE, FK_TAX_CALCULATION_RATE_TITLE_RATE" to table "tax_calculation_rate_title"
Add missing foreign key(s) "FK_TAX_ORDER_AGGREGATED_CREATED_STORE" to table "tax_order_aggregated_created"
Add missing foreign key(s) "FK_CATALOG_PRODUCT_ENTITY_WEEE_DISCOUNT_PRODUCT_ENTITY, FK_CATALOG_PRODUCT_ENTITY_WEEE_DISCOUNT_WEBSITE, FK_CATALOG_PRODUCT_ENTITY_WEEE_DISCOUNT_GROUP" to table "weee_discount"
Add missing foreign key(s) "FK_CATALOG_PRODUCT_ENTITY_WEEE_TAX_COUNTRY, FK_CATALOG_PRODUCT_ENTITY_WEEE_TAX_PRODUCT_ENTITY, FK_CATALOG_PRODUCT_ENTITY_WEEE_TAX_WEBSITE, FK_WEEE_TAX_ATTRIBUTE_ID" to table "weee_tax"
Add missing foreign key(s) "FK_WIDGET_WIDGET_INSTANCE_ID" to table "widget_instance_page"
Add missing foreign key(s) "FK_WIDGET_WIDGET_INSTANCE_LAYOUT_UPDATE_ID, FK_WIDGET_WIDGET_INSTANCE_PAGE_ID" to table "widget_instance_page_layout"
Add missing foreign key(s) "FK_WISHLIST_CUSTOMER" to table "wishlist"
Add missing foreign key(s) "FK_WISHLIST_ITEM_PRODUCT, FK_WISHLIST_ITEM_STORE, FK_WISHLIST_ITEM_WISHLIST" to table "wishlist_item"
Add missing foreign key(s) "FK_WISHLIST_ITEM_OPTION_ITEM_ID" to table "wishlist_item_option"
Add missing foreign key(s) "FK_XMLCONNECT_APPLICAION_STORE" to table "xmlconnect_application"
Add missing foreign key(s) "FK_XMLCONNECT_HISTORY_APPLICATION" to table "xmlconnect_history"
Add missing foreign key(s) "FK_APP_CODE" to table "xmlconnect_notification_template"
Add missing foreign key(s) "FK_TEMPLATE_ID" to table "xmlconnect_queue"
回答1:
It's impossible to say for sure with this information whether it is safe to run the tool on your production database. Since you have a copy of the database, create a copy of Magento that points to that database and test it to see if the repair tool worked.
Thankfully, the first row of the repair added sort_order
to customer_eav_attribute
, which sounds like it is probably your ca.sort_order
issue. Once you've verified that the repair was in fact successful, you can run it on your production database.
Hope that helps!
Thanks, Joe
来源:https://stackoverflow.com/questions/5761298/magento-database-repair-tool-added-missing-foreign-keys-problems