ALTER TABLE AD_User ADD CONSTRAINT BPLocation_ADUser FOREIGN KEY(BP_Location_ID) REFERENCES C_Location(C_Location_ID) DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE AD_User ADD CONSTRAINT CLocation_ADUser FOREIGN KEY(C_Location_ID) REFERENCES C_Location(C_Location_ID) DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE C_AcctSchema_Default ADD CONSTRAINT PLandedCostClearingvc_CAcctSch FOREIGN KEY(P_LandedCostClearing_Acct) REFERENCES C_ValidCombination(C_ValidCombination_ID) DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE M_Product_Acct ADD CONSTRAINT PLandedCostClearingvc_MProdAcc FOREIGN KEY(P_LandedCostClearing_Acct) REFERENCES C_ValidCombination(C_ValidCombination_ID) DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE M_Product_Category_Acct ADD CONSTRAINT PLandedCostClearingvc_MPrCatAc FOREIGN KEY(P_LandedCostClearing_Acct) REFERENCES C_ValidCombination(C_ValidCombination_ID) DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE AD_Chart ADD CONSTRAINT EntityT_ADChart FOREIGN KEY (EntityType) REFERENCES AD_EntityType DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE AD_ChartDatasource ADD CONSTRAINT ADChart_ADChartDatasource FOREIGN KEY (AD_Chart_ID) REFERENCES AD_Chart DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE AD_ChartDatasource ADD CONSTRAINT EntityT_ADChartDatasource FOREIGN KEY (EntityType) REFERENCES AD_EntityType DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE AD_ChartDatasource ADD CONSTRAINT ADTable_ADChartDatasource FOREIGN KEY (AD_Table_ID) REFERENCES AD_Table DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE AD_Column ADD CONSTRAINT ADChart_ADColumn FOREIGN KEY (AD_Chart_ID) REFERENCES AD_Chart DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE AD_IndexColumn ADD CONSTRAINT ADColumn_ADIndexColumn FOREIGN KEY (AD_Column_ID) REFERENCES AD_Column DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE AD_IndexColumn ADD CONSTRAINT EntityT_ADIndexColumn FOREIGN KEY (EntityType) REFERENCES AD_EntityType DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE AD_IndexColumn ADD CONSTRAINT ADTableIndex_ADIndexColumn FOREIGN KEY (AD_TableIndex_ID) REFERENCES AD_TableIndex DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE AD_Package_UUID_Map ADD CONSTRAINT ADTable_ADPackageUUIDMap FOREIGN KEY (AD_Table_ID) REFERENCES AD_Table DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE AD_PrintFormat ADD CONSTRAINT ADWindow_ADPrintFormat FOREIGN KEY (AD_Window_ID) REFERENCES AD_Window DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE AD_TableIndex ADD CONSTRAINT EntityT_ADTableIndex FOREIGN KEY (EntityType) REFERENCES AD_EntityType DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE AD_TableIndex ADD CONSTRAINT ADMessage_ADTableIndex FOREIGN KEY (AD_Message_ID) REFERENCES AD_Message DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE AD_TableIndex ADD CONSTRAINT ADTable_ADTableIndex FOREIGN KEY (AD_Table_ID) REFERENCES AD_Table DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE AD_User ADD CONSTRAINT SalesRep_ADUser FOREIGN KEY (SalesRep_ID) REFERENCES AD_User DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE AD_User ADD CONSTRAINT CCampaign_ADUser FOREIGN KEY (C_Campaign_ID) REFERENCES C_Campaign DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE AD_ViewColumn ADD CONSTRAINT EntityT_ADViewColumn FOREIGN KEY (EntityType) REFERENCES AD_EntityType DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE AD_ViewColumn ADD CONSTRAINT ADViewComponent_ADViewColumn FOREIGN KEY (AD_ViewComponent_ID) REFERENCES AD_ViewComponent DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE AD_ViewComponent ADD CONSTRAINT EntityT_ADViewComponent FOREIGN KEY (EntityType) REFERENCES AD_EntityType DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE AD_ViewComponent ADD CONSTRAINT ADTable_ADViewComponent FOREIGN KEY (AD_Table_ID) REFERENCES AD_Table DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE AD_ViewComponent ADD CONSTRAINT ReferencedTable_ADViewComponen FOREIGN KEY (Referenced_Table_ID) REFERENCES AD_Table DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE AD_ZoomCondition ADD CONSTRAINT ADTable_ADZoomCondition FOREIGN KEY (AD_Table_ID) REFERENCES AD_Table DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE AD_ZoomCondition ADD CONSTRAINT ADWindow_ADZoomCondition FOREIGN KEY (AD_Window_ID) REFERENCES AD_Window DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE C_ContactActivity ADD CONSTRAINT ADUser_CContactActivity FOREIGN KEY (AD_User_ID) REFERENCES AD_User DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE C_ContactActivity ADD CONSTRAINT COpportunity_CContactActivity FOREIGN KEY (C_Opportunity_ID) REFERENCES C_Opportunity DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE C_LandedCostAllocation ADD CONSTRAINT MInOutLine_CLandedCostAllocati FOREIGN KEY (M_InOutLine_ID) REFERENCES M_InOutLine DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE C_Opportunity ADD CONSTRAINT ADUser_COpportunity FOREIGN KEY (AD_User_ID) REFERENCES AD_User DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE C_Opportunity ADD CONSTRAINT SalesRep_COpportunity FOREIGN KEY (SalesRep_ID) REFERENCES AD_User DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE C_Opportunity ADD CONSTRAINT CBPartner_COpportunity FOREIGN KEY (C_BPartner_ID) REFERENCES C_BPartner DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE C_Opportunity ADD CONSTRAINT CCampaign_COpportunity FOREIGN KEY (C_Campaign_ID) REFERENCES C_Campaign DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE C_Opportunity ADD CONSTRAINT CCurrency_COpportunity FOREIGN KEY (C_Currency_ID) REFERENCES C_Currency DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE C_Opportunity ADD CONSTRAINT COrder_COpportunity FOREIGN KEY (C_Order_ID) REFERENCES C_Order DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE C_Opportunity ADD CONSTRAINT CSalesStage_COpportunity FOREIGN KEY (C_SalesStage_ID) REFERENCES C_SalesStage DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE C_Order ADD CONSTRAINT COpportunity_COrder FOREIGN KEY (C_Opportunity_ID) REFERENCES C_Opportunity DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE C_OrderLandedCost ADD CONSTRAINT COrder_COrderLandedCost FOREIGN KEY (C_Order_ID) REFERENCES C_Order DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE C_OrderLandedCost ADD CONSTRAINT MCostElement_COrderLandedCost FOREIGN KEY (M_CostElement_ID) REFERENCES M_CostElement DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE C_OrderLandedCostAllocation ADD CONSTRAINT COrderLandedCost_COrderLandedC FOREIGN KEY (C_OrderLandedCost_ID) REFERENCES C_OrderLandedCost DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE C_OrderLandedCostAllocation ADD CONSTRAINT COrderLine_COrderLandedCostAll FOREIGN KEY (C_OrderLine_ID) REFERENCES C_OrderLine DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE M_BP_Price ADD CONSTRAINT CBPartner_MBPPrice FOREIGN KEY (C_BPartner_ID) REFERENCES C_BPartner DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE M_BP_Price ADD CONSTRAINT CCurrency_MBPPrice FOREIGN KEY (C_Currency_ID) REFERENCES C_Currency DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE M_BP_Price ADD CONSTRAINT MProduct_MBPPrice FOREIGN KEY (M_Product_ID) REFERENCES M_Product DEFERRABLE INITIALLY DEFERRED;

SELECT register_migration_script('201310311919_FKsRelease2.sql') FROM dual
;

