if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Article_Article_Class]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Article] DROP CONSTRAINT FK_Article_Article_Class
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Binding_Goods_Binding]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Binding_Goods] DROP CONSTRAINT FK_Binding_Goods_Binding
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_User_Coupon_Coupon]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[User_Coupon] DROP CONSTRAINT FK_User_Coupon_Coupon
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Distribute_Area_Distribute]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Distribute_Area] DROP CONSTRAINT FK_Distribute_Area_Distribute
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Binding_Goods_Goods]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Binding_Goods] DROP CONSTRAINT FK_Binding_Goods_Goods
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Goods_Analogy_Goods]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Goods_Analogy] DROP CONSTRAINT FK_Goods_Analogy_Goods
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Goods_Ask_Goods]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Goods_Ask] DROP CONSTRAINT FK_Goods_Ask_Goods
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Goods_Assemble_Goods]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Goods_Assemble] DROP CONSTRAINT FK_Goods_Assemble_Goods
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Goods_Attribute_Goods]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Goods_Attribute] DROP CONSTRAINT FK_Goods_Attribute_Goods
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Goods_Class_Hot_Goods]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Goods_Class_Hot] DROP CONSTRAINT FK_Goods_Class_Hot_Goods
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Goods_Discuss_Goods]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Goods_Discuss] DROP CONSTRAINT FK_Goods_Discuss_Goods
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Goods_Image_Goods]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Goods_Image] DROP CONSTRAINT FK_Goods_Image_Goods
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Goods_Images_Goods]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Goods_Images] DROP CONSTRAINT FK_Goods_Images_Goods
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Goods_OOS_Goods]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Goods_OOS] DROP CONSTRAINT FK_Goods_OOS_Goods
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Goods_OptionGroup_Goods]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Goods_OptionGroup] DROP CONSTRAINT FK_Goods_OptionGroup_Goods
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Goods_Parameter_Goods]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Goods_Parameter] DROP CONSTRAINT FK_Goods_Parameter_Goods
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Goods_Privilege_Goods]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Goods_Privilege] DROP CONSTRAINT FK_Goods_Privilege_Goods
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Goods_TransactionsNote_Goods]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Goods_TransactionsNote] DROP CONSTRAINT FK_Goods_TransactionsNote_Goods
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Goods_UserPrice_Goods]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Goods_UserPrice] DROP CONSTRAINT FK_Goods_UserPrice_Goods
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Goods_Wholesale_Goods]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Goods_Wholesale] DROP CONSTRAINT FK_Goods_Wholesale_Goods
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_User_Discuss_Goods]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[User_Discuss] DROP CONSTRAINT FK_User_Discuss_Goods
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_User_Favorite_Goods]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[User_Favorite] DROP CONSTRAINT FK_User_Favorite_Goods
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Goods_AttributeValue_Goods_Attribute]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Goods_AttributeValue] DROP CONSTRAINT FK_Goods_AttributeValue_Goods_Attribute
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Goods_AttributeValueImage_Goods_AttributeValue]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Goods_AttributeValueImage] DROP CONSTRAINT FK_Goods_AttributeValueImage_Goods_AttributeValue
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Goods_Class_Filter_Goods_Class]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Goods_Class_Filter] DROP CONSTRAINT FK_Goods_Class_Filter_Goods_Class
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Goods_Class_Hot_Goods_Class]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Goods_Class_Hot] DROP CONSTRAINT FK_Goods_Class_Hot_Goods_Class
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Goods_Class_FilterValue_Goods_Class_Filter]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Goods_Class_FilterValue] DROP CONSTRAINT FK_Goods_Class_FilterValue_Goods_Class_Filter
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Shop_Function_Shop_Module]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Manager_Function] DROP CONSTRAINT FK_Shop_Function_Shop_Module
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_OptionGroup_Option_OptionGroup]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[OptionGroup_Option] DROP CONSTRAINT FK_OptionGroup_Option_OptionGroup
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Order_Goods_Order]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Order_Goods] DROP CONSTRAINT FK_Order_Goods_Order
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Order_State_Order]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Order_State] DROP CONSTRAINT FK_Order_State_Order
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_User_Order_Order]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[User_Order] DROP CONSTRAINT FK_User_Order_Order
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Goods_OOS_User]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Goods_OOS] DROP CONSTRAINT FK_Goods_OOS_User
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_User_Consignee_User]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[User_Consignee] DROP CONSTRAINT FK_User_Consignee_User
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_User_Coupon_User]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[User_Coupon] DROP CONSTRAINT FK_User_Coupon_User
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_User_Discuss_User]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[User_Discuss] DROP CONSTRAINT FK_User_Discuss_User
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_User_Favorite_User]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[User_Favorite] DROP CONSTRAINT FK_User_Favorite_User
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_User_Message_User]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[User_Message] DROP CONSTRAINT FK_User_Message_User
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_User_Order_User]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[User_Order] DROP CONSTRAINT FK_User_Order_User
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_User_PointsNote_User]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[User_PointsNote] DROP CONSTRAINT FK_User_PointsNote_User
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_User_RechargeNote_User]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[User_RechargeNote] DROP CONSTRAINT FK_User_RechargeNote_User
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_User_WithdrawsCash_User]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[User_WithdrawsCash] DROP CONSTRAINT FK_User_WithdrawsCash_User
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_User_Card_User_CardGroup]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[User_Card] DROP CONSTRAINT FK_User_Card_User_CardGroup
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Goods_UserPrice_User_Group]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Goods_UserPrice] DROP CONSTRAINT FK_Goods_UserPrice_User_Group
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Goods_Wholesale_User_Group]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Goods_Wholesale] DROP CONSTRAINT FK_Goods_Wholesale_User_Group
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_User_User_Group]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[User] DROP CONSTRAINT FK_User_User_Group
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_User_Card_User_Group]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[User_Card] DROP CONSTRAINT FK_User_Card_User_Group
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Article]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Article]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Article_Class]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Article_Class]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Binding]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Binding]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Binding_Goods]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Binding_Goods]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Coupon]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Coupon]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DataBaseBackup]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[DataBaseBackup]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Distribute]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Distribute]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Distribute_Area]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Distribute_Area]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FriendsLinks]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[FriendsLinks]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Goods]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Goods]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Goods_Analogy]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Goods_Analogy]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Goods_Ask]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Goods_Ask]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Goods_Assemble]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Goods_Assemble]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Goods_Attribute]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Goods_Attribute]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Goods_AttributeValue]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Goods_AttributeValue]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Goods_AttributeValueImage]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Goods_AttributeValueImage]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Goods_Binding]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Goods_Binding]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Goods_Brand]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Goods_Brand]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Goods_Class]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Goods_Class]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Goods_Class_Filter]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Goods_Class_Filter]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Goods_Class_FilterValue]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Goods_Class_FilterValue]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Goods_Class_Hot]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Goods_Class_Hot]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Goods_Consignment]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Goods_Consignment]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Goods_Discuss]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Goods_Discuss]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Goods_FilterCategory]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Goods_FilterCategory]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Goods_Image]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Goods_Image]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Goods_Images]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Goods_Images]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Goods_Information]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Goods_Information]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Goods_OOS]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Goods_OOS]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Goods_OptionGroup]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Goods_OptionGroup]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Goods_Parameter]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Goods_Parameter]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Goods_Privilege]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Goods_Privilege]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Goods_Reple]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Goods_Reple]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Goods_Tag]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Goods_Tag]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Goods_TransactionsNote]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Goods_TransactionsNote]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Goods_UserPrice]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Goods_UserPrice]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Goods_Wholesale]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Goods_Wholesale]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Manager]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Manager]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Manager_Function]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Manager_Function]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Manager_Module]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Manager_Module]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Manager_Note]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Manager_Note]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Manager_Role]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Manager_Role]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Notice]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Notice]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[OptionGroup]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[OptionGroup]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[OptionGroup_Option]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[OptionGroup_Option]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Order]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Order]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Order_Goods]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Order_Goods]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Order_Restore]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Order_Restore]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Order_State]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Order_State]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Payment_Interface]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Payment_Interface]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Privilege]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Privilege]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ShopBBS]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[ShopBBS]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Shop_CostomTag]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Shop_CostomTag]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Shop_Help]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Shop_Help]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[User]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[User]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[User_Card]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[User_Card]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[User_CardGroup]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[User_CardGroup]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[User_Consignee]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[User_Consignee]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[User_Coupon]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[User_Coupon]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[User_Discuss]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[User_Discuss]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[User_Favorite]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[User_Favorite]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[User_Group]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[User_Group]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[User_Message]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[User_Message]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[User_Order]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[User_Order]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[User_PointsNote]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[User_PointsNote]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[User_RechargeNote]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[User_RechargeNote]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[User_WithdrawsCash]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[User_WithdrawsCash]
GO

CREATE TABLE [dbo].[Article] (
	[ArticleGuid] [uniqueidentifier] NOT NULL ,
	[ArticleClass] [uniqueidentifier] NOT NULL ,
	[ArticleTitle] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ArticleBody] [ntext] COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[IsShow] [bit] NOT NULL ,
	[JoinDate] [datetime] NOT NULL ,
	[ArticleUrl] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[ArticleOrder] [int] NOT NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[Article_Class] (
	[ClassGuid] [uniqueidentifier] NOT NULL ,
	[ClassName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ClassDescription] [ntext] COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[Binding] (
	[BindingGuid] [uniqueidentifier] NOT NULL ,
	[BindingName] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[BindingNumber] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[BindingPrice] [money] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Binding_Goods] (
	[ID] [uniqueidentifier] NOT NULL ,
	[GoodsGuid] [uniqueidentifier] NOT NULL ,
	[BindingGuid] [uniqueidentifier] NOT NULL ,
	[BindingGoodsNumber] [int] NOT NULL ,
	[ReasonablePrice] [money] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Coupon] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[CouponName] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[MeetPrice] [money] NOT NULL ,
	[MortagagePrice] [money] NOT NULL ,
	[OutDate] [datetime] NOT NULL ,
	[BlankOut] [bit] NOT NULL ,
	[PutOut] [bit] NOT NULL ,
	[Remak] [ntext] COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[DataBaseBackup] (
	[Guid] [uniqueidentifier] NOT NULL ,
	[DataBaseName] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[DataBaseSize] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[DataBaseVersion] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[BackupDate] [datetime] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Distribute] (
	[DistributeGuid] [uniqueidentifier] NOT NULL ,
	[DistributeName] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[DistributeExpressions] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[IsProtect] [bit] NOT NULL ,
	[ProtectPercent] [int] NOT NULL ,
	[ProtectPrice] [money] NOT NULL ,
	[DistributeRemarks] [ntext] COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[Distribute_Area] (
	[ID] [uniqueidentifier] NOT NULL ,
	[Area] [ntext] COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[DistributeGuid] [uniqueidentifier] NOT NULL ,
	[DistributeExpressions] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[IsDelivery] [bit] NOT NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[FriendsLinks] (
	[FriendsLinksGuid] [uniqueidentifier] NOT NULL ,
	[FriendsLinksName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[FriendsLinksUrl] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[FriendsLinksImage] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[IsShow] [bit] NOT NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[Goods] (
	[GoodsGuid] [uniqueidentifier] NOT NULL ,
	[ClassGuid] [uniqueidentifier] NOT NULL ,
	[BrandGuid] [uniqueidentifier] NOT NULL ,
	[GoodsName] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[GoodsNumber] [nvarchar] (250) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[GoodsMeasure] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[GoodsPrice] [money] NOT NULL ,
	[GoodsMarketPrice] [money] NULL ,
	[GoodsSummarize] [nvarchar] (3000) COLLATE Chinese_PRC_CI_AS NULL ,
	[GoodsContent] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[GoodsHeft] [int] NULL ,
	[GoodsTag] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[GoodsSell] [bit] NOT NULL ,
	[GoodsStock] [int] NULL ,
	[GoodsPoint] [int] NOT NULL ,
	[JoinDate] [datetime] NOT NULL ,
	[CostPrice] [money] NULL ,
	[SEOTitle] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
	[SEOKeywords] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
	[SEOContent] [nvarchar] (1000) COLLATE Chinese_PRC_CI_AS NULL ,
	[BrowseNumber] [int] NULL ,
	[SellNumber] [int] NULL ,
	[GoodsOrder] [int] NOT NULL ,
	[OtherClass] [nvarchar] (1000) COLLATE Chinese_PRC_CI_AS NULL ,
	[GoodsFilter] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[Goods_Analogy] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[GoodsID] [uniqueidentifier] NOT NULL ,
	[AnalogyID] [uniqueidentifier] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Goods_Ask] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[GoodsGuid] [uniqueidentifier] NOT NULL ,
	[GoodsName] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[UserName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[AskType] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[AskTitle] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[AskBody] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[AskRestore] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[AskDate] [datetime] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Goods_Assemble] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[GoodsID] [uniqueidentifier] NOT NULL ,
	[Number] [nvarchar] (250) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[AssembleValue] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Stock] [int] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Goods_Attribute] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[GoodsID] [uniqueidentifier] NOT NULL ,
	[Name] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Goods_AttributeValue] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[AttributeID] [int] NOT NULL ,
	[AttributeValue] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Goods_AttributeValueImage] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[AttributeValueID] [int] NOT NULL ,
	[Image] [nvarchar] (1000) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[SmallImage] [nvarchar] (1000) COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Goods_Binding] (
	[ID] [uniqueidentifier] NOT NULL ,
	[GoodsGuid] [uniqueidentifier] NOT NULL ,
	[BindingGuid] [uniqueidentifier] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Goods_Brand] (
	[BrandGuid] [uniqueidentifier] NOT NULL ,
	[BrandName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[BrandContent] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[BrandUrl] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[BrandLogo] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[IsShow] [bit] NOT NULL ,
	[BrandOrder] [int] NOT NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[Goods_Class] (
	[ClassGuid] [uniqueidentifier] NOT NULL ,
	[ParentGuid] [uniqueidentifier] NOT NULL ,
	[ClassName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ClassOrder] [int] NOT NULL ,
	[IsShow] [bit] NOT NULL ,
	[Remark] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[ClassUrl] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[ClassImage] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[ClassTemplate] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[Goods_Class_Filter] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[ClassGuid] [uniqueidentifier] NOT NULL ,
	[FilterName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Goods_Class_FilterValue] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[FilterID] [int] NOT NULL ,
	[FilterValue] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Goods_Class_Hot] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[ClassID] [uniqueidentifier] NOT NULL ,
	[GoodsID] [uniqueidentifier] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Goods_Consignment] (
	[ConsignmentID] [int] IDENTITY (1, 1) NOT NULL ,
	[ConsignmentNumber] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[OrderID] [int] NOT NULL ,
	[Consignee] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Phone] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Mobile] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Email] [nvarchar] (250) COLLATE Chinese_PRC_CI_AS NULL ,
	[Address] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[ZipCode] [nvarchar] (6) COLLATE Chinese_PRC_CI_AS NULL ,
	[LogisticsPrice] [money] NULL ,
	[LogisticsCompany] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[DeliverMode] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[LogisticsCompanyNumber] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[Remarks] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[DeliverDate] [datetime] NOT NULL ,
	[CreateDate] [datetime] NOT NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[Goods_Discuss] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[GoodsGuid] [uniqueidentifier] NOT NULL ,
	[Name] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[DiscussTitle] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[DiscussBody] [ntext] COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[DiscussGrade] [int] NOT NULL ,
	[DiscussDate] [datetime] NOT NULL ,
	[DiscussRestore] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[DiscussYes] [int] NOT NULL ,
	[DiscussNo] [int] NOT NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[Goods_FilterCategory] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[ParentID] [int] NOT NULL ,
	[FilterCategoryName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[FilterCategoryOrder] [int] NOT NULL ,
	[FilterCategoryUrl] [ntext] COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[IsShow] [bit] NOT NULL ,
	[Remark] [ntext] COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[Goods_Image] (
	[ID] [uniqueidentifier] NOT NULL ,
	[GoodsGuid] [uniqueidentifier] NOT NULL ,
	[BigImage] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[ThumbnailsImage] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[SmallImage] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[MicroImage] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[MediumImage] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[ListImage] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[OriginalityImage] [ntext] COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[Goods_Images] (
	[ID] [uniqueidentifier] NOT NULL ,
	[GoodsGuid] [uniqueidentifier] NOT NULL ,
	[ImageUrl] [ntext] COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[SmallImageUrl] [ntext] COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[Goods_Information] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[GoodsID] [int] NOT NULL ,
	[GoodsNew] [bit] NULL ,
	[GoodsHot] [bit] NULL ,
	[GoodsCommend] [bit] NULL ,
	[GoodsRebate] [bit] NULL ,
	[GoodsType] [bit] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Goods_OOS] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[GoodsName] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[GoodsID] [uniqueidentifier] NOT NULL ,
	[UserID] [uniqueidentifier] NOT NULL ,
	[Name] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Contact] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Body] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[BuyNumber] [int] NOT NULL ,
	[OOSDate] [datetime] NOT NULL ,
	[Remark] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[State] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Goods_OptionGroup] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[GoodsID] [uniqueidentifier] NOT NULL ,
	[OptionGroupID] [uniqueidentifier] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Goods_Parameter] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[GoodsGuid] [uniqueidentifier] NOT NULL ,
	[ParameterName] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ParameterValue] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ParameterGroupName] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Goods_Privilege] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[GoodsID] [uniqueidentifier] NOT NULL ,
	[PrivilegeTag] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[IsTimeLimit] [bit] NOT NULL ,
	[StartTime] [datetime] NOT NULL ,
	[EndTime] [datetime] NOT NULL ,
	[DiscountPrice] [money] NOT NULL ,
	[RemittedPrice] [money] NOT NULL ,
	[UsePoint] [int] NOT NULL ,
	[IsUsePoint] [bit] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Goods_Reple] (
	[RepleGuid] [uniqueidentifier] NOT NULL ,
	[Name] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[RepleTitle] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[RepleBody] [ntext] COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[RepleDate] [datetime] NOT NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[Goods_Tag] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[Tag] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[IsShow] [bit] NOT NULL ,
	[AddDate] [datetime] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Goods_TransactionsNote] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[GoodsID] [uniqueidentifier] NOT NULL ,
	[UserName] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[GoodsName] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[BuyNumber] [int] NOT NULL ,
	[TransactionsDate] [datetime] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Goods_UserPrice] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[GoodsID] [uniqueidentifier] NOT NULL ,
	[UserGroup] [int] NOT NULL ,
	[Price] [money] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Goods_Wholesale] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[GoodsID] [uniqueidentifier] NOT NULL ,
	[UserGroup] [int] NOT NULL ,
	[MeetNumber] [int] NOT NULL ,
	[Price] [money] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Manager] (
	[ManagerGuid] [uniqueidentifier] NOT NULL ,
	[RoleGuid] [uniqueidentifier] NOT NULL ,
	[ManagerName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Password] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[IsCreator] [bit] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Manager_Function] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[ModuleNo] [int] NOT NULL ,
	[FuncNo] [int] NOT NULL ,
	[FuncName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[FuncEName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Manager_Module] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[ModuleName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ModuleEName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Manager_Note] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[PageUrl] [nvarchar] (800) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[NoteDate] [datetime] NOT NULL ,
	[UserName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[UserIP] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Description] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Manager_Role] (
	[RoleGuid] [uniqueidentifier] NOT NULL ,
	[RoleName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[RoleAction] [nvarchar] (2000) COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Notice] (
	[NoticeGuid] [uniqueidentifier] NOT NULL ,
	[NoticeTitle] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[NoticeBody] [ntext] COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[NoticeDate] [datetime] NOT NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[OptionGroup] (
	[ID] [uniqueidentifier] NOT NULL ,
	[Name] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[IsRadio] [bit] NOT NULL ,
	[Remark] [ntext] COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[OptionGroup_Option] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[GroupID] [uniqueidentifier] NOT NULL ,
	[OptionTitle] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[OptionPrice] [money] NOT NULL ,
	[OptionRemark] [ntext] COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[Order] (
	[OrderNumber] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[OrderType] [bit] NOT NULL ,
	[OrderState] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ConsigneeName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ConsigneePhone] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ConsigneeMobile] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ConsigneeEmail] [nvarchar] (250) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ConsigneeAddress] [ntext] COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ConsigneeZipCode] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[OrderPrice] [money] NOT NULL ,
	[PaymentMode] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[DispatchArea] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[DispatchMode] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[DispatchPrice] [money] NOT NULL ,
	[IsInvoice] [bit] NOT NULL ,
	[IsProtect] [bit] NOT NULL ,
	[CreateDate] [datetime] NOT NULL ,
	[DeliverDay] [nvarchar] (150) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[DeliverTime] [nvarchar] (150) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[InvoiceHead] [nvarchar] (150) COLLATE Chinese_PRC_CI_AS NULL ,
	[LogisticsCompany] [nvarchar] (150) COLLATE Chinese_PRC_CI_AS NULL ,
	[CourierTrackingNumber] [nvarchar] (150) COLLATE Chinese_PRC_CI_AS NULL ,
	[ProtectPrice] [money] NULL ,
	[AccountBank] [nvarchar] (150) COLLATE Chinese_PRC_CI_AS NULL ,
	[AccountBankNumber] [nvarchar] (150) COLLATE Chinese_PRC_CI_AS NULL ,
	[Taxation] [money] NULL ,
	[Remark] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
	[OrderInvoice] [ntext] COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[Order_Goods] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[OrderNumber] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[PayNumber] [int] NOT NULL ,
	[Name] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Number] [nvarchar] (250) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Price] [money] NOT NULL ,
	[OriginalPrice] [money] NOT NULL ,
	[Remark] [ntext] COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[Order_Restore] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[OrderNumber] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Operator] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Remark] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[RestoreDate] [datetime] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Order_State] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[OrderNumber] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[OrderState] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[OrderOperator] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Remark] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[CreateDate] [datetime] NOT NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[Payment_Interface] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[PaymentTag] [nvarchar] (20) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[PaymentName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[IsOpen] [bit] NOT NULL ,
	[AccountNumber] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[AccountKey] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[AccountSigh] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[PayRate] [float] NOT NULL ,
	[Description] [ntext] COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[Privilege] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[PrivilegeType] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[PrivilegeName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[StartTime] [datetime] NOT NULL ,
	[EndTime] [datetime] NOT NULL ,
	[MeetPrice] [money] NOT NULL ,
	[PriceOrDiscount] [decimal](18, 2) NOT NULL ,
	[PrivilegeInfo] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[ShopBBS] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[Name] [nvarchar] (20) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Contact] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[BBSTitle] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[BBSBody] [ntext] COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[BBSDate] [datetime] NOT NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[Shop_CostomTag] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[Name] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[TagName] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[TagValue] [ntext] COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Remark] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[Shop_Help] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[ParentID] [int] NOT NULL ,
	[Title] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Body] [ntext] COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[IsShow] [bit] NOT NULL ,
	[SortOrder] [int] NOT NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[User] (
	[UserGuid] [uniqueidentifier] NOT NULL ,
	[UserGroup] [int] NULL ,
	[UserName] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[UserPassword] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Email] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Deposit] [money] NOT NULL ,
	[Point] [int] NOT NULL ,
	[JoinDate] [datetime] NOT NULL ,
	[RealName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Address] [nvarchar] (1000) COLLATE Chinese_PRC_CI_AS NULL ,
	[Phone] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Mobile] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Zip] [nvarchar] (10) COLLATE Chinese_PRC_CI_AS NULL ,
	[Area] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[User_Card] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[GroupID] [int] NOT NULL ,
	[CardTitle] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[GiftUserGroup] [int] NOT NULL ,
	[GiftPoint] [int] NOT NULL ,
	[GiftAmount] [money] NOT NULL ,
	[CardNumber] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Activation] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[IsActivation] [bit] NOT NULL ,
	[IsSend] [bit] NOT NULL ,
	[StartDate] [datetime] NOT NULL ,
	[EffectiveDate] [datetime] NOT NULL ,
	[SendDate] [datetime] NOT NULL ,
	[ActivationDate] [datetime] NOT NULL ,
	[CreateDate] [datetime] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[User_CardGroup] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[Title] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Remark] [ntext] COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[User_Consignee] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[UserID] [uniqueidentifier] NOT NULL ,
	[Consignee] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ConsigneePhone] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ConsigneeMobile] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ConsigneeEmail] [nvarchar] (250) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ConsigneeAddress] [ntext] COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ConsigneeZipCode] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[DispatchArea] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[User_Coupon] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[UserID] [uniqueidentifier] NOT NULL ,
	[CouponID] [int] NOT NULL ,
	[CouponNumber] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[BlankOut] [bit] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[User_Discuss] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[UserID] [uniqueidentifier] NOT NULL ,
	[GoodsID] [uniqueidentifier] NOT NULL ,
	[State] [bit] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[User_Favorite] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[UserID] [uniqueidentifier] NOT NULL ,
	[GoodsID] [uniqueidentifier] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[User_Group] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[GroupName] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[MeetPoint] [int] NOT NULL ,
	[Discount] [float] NOT NULL ,
	[Remark] [ntext] COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[User_Message] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[UserGuid] [uniqueidentifier] NOT NULL ,
	[MessageTitle] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[MessageBody] [ntext] COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[MessageDate] [datetime] NOT NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[User_Order] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[UserGuid] [uniqueidentifier] NOT NULL ,
	[OrderNumber] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[User_PointsNote] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[UserGuid] [uniqueidentifier] NOT NULL ,
	[NoteDate] [datetime] NOT NULL ,
	[PointsValue] [int] NOT NULL ,
	[Description] [ntext] COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Operator] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[User_RechargeNote] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[UserGuid] [uniqueidentifier] NOT NULL ,
	[RechargeValue] [money] NOT NULL ,
	[NoteDate] [datetime] NOT NULL ,
	[Description] [ntext] COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Operator] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[User_WithdrawsCash] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[UserGuid] [uniqueidentifier] NOT NULL ,
	[WithdrawsPrice] [money] NOT NULL ,
	[State] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Remark] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[ApplyDate] [datetime] NOT NULL 
) ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Article] WITH NOCHECK ADD 
	CONSTRAINT [PK_Article] PRIMARY KEY  CLUSTERED 
	(
		[ArticleGuid]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Article_Class] WITH NOCHECK ADD 
	CONSTRAINT [PK_Article_Class] PRIMARY KEY  CLUSTERED 
	(
		[ClassGuid]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Binding] WITH NOCHECK ADD 
	CONSTRAINT [PK_Binding] PRIMARY KEY  CLUSTERED 
	(
		[BindingGuid]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Binding_Goods] WITH NOCHECK ADD 
	CONSTRAINT [PK_Binding_Goods] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Coupon] WITH NOCHECK ADD 
	CONSTRAINT [PK_Coupon] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[DataBaseBackup] WITH NOCHECK ADD 
	CONSTRAINT [PK_DataBaseBackup] PRIMARY KEY  CLUSTERED 
	(
		[Guid]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Distribute] WITH NOCHECK ADD 
	CONSTRAINT [PK_Distribute] PRIMARY KEY  CLUSTERED 
	(
		[DistributeGuid]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Distribute_Area] WITH NOCHECK ADD 
	CONSTRAINT [PK_Distribute_Area_1] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[FriendsLinks] WITH NOCHECK ADD 
	CONSTRAINT [PK_FriendsLinks] PRIMARY KEY  CLUSTERED 
	(
		[FriendsLinksGuid]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Goods] WITH NOCHECK ADD 
	CONSTRAINT [PK_Goods] PRIMARY KEY  CLUSTERED 
	(
		[GoodsGuid]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Goods_Analogy] WITH NOCHECK ADD 
	CONSTRAINT [PK_Goods_AnalogyGoods] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Goods_Ask] WITH NOCHECK ADD 
	CONSTRAINT [PK_Goods_Ask] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Goods_Assemble] WITH NOCHECK ADD 
	CONSTRAINT [PK_Goods_Assemble] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Goods_Attribute] WITH NOCHECK ADD 
	CONSTRAINT [PK_Goods_Attribute_1] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Goods_AttributeValue] WITH NOCHECK ADD 
	CONSTRAINT [PK_Goods_AttributeValue] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Goods_AttributeValueImage] WITH NOCHECK ADD 
	CONSTRAINT [PK_Goods_AttributeValueImage] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Goods_Binding] WITH NOCHECK ADD 
	CONSTRAINT [PK_Goods_GoodsBinding] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Goods_Brand] WITH NOCHECK ADD 
	CONSTRAINT [PK_Goods_Brand] PRIMARY KEY  CLUSTERED 
	(
		[BrandGuid]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Goods_Class] WITH NOCHECK ADD 
	CONSTRAINT [PK_Goods_Class] PRIMARY KEY  CLUSTERED 
	(
		[ClassGuid]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Goods_Class_Filter] WITH NOCHECK ADD 
	CONSTRAINT [PK_Goods_Class_Filter] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Goods_Class_FilterValue] WITH NOCHECK ADD 
	CONSTRAINT [PK_Goods_Class_FilterValye] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Goods_Class_Hot] WITH NOCHECK ADD 
	CONSTRAINT [PK_Goods_Class_Hot] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Goods_Consignment] WITH NOCHECK ADD 
	CONSTRAINT [PK_Goods_Consignment] PRIMARY KEY  CLUSTERED 
	(
		[ConsignmentID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Goods_Discuss] WITH NOCHECK ADD 
	CONSTRAINT [PK_Goods_Discuss] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Goods_FilterCategory] WITH NOCHECK ADD 
	CONSTRAINT [PK_Goods_FilterCategory] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Goods_Image] WITH NOCHECK ADD 
	CONSTRAINT [PK_Goods_Image] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Goods_Images] WITH NOCHECK ADD 
	CONSTRAINT [PK_Goods_Images] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Goods_Information] WITH NOCHECK ADD 
	CONSTRAINT [PK_Goods_Information] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Goods_OOS] WITH NOCHECK ADD 
	CONSTRAINT [PK_Goods_OOS] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Goods_OptionGroup] WITH NOCHECK ADD 
	CONSTRAINT [PK_Goods_Optional] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Goods_Parameter] WITH NOCHECK ADD 
	CONSTRAINT [PK_Goods_Parameter] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Goods_Privilege] WITH NOCHECK ADD 
	CONSTRAINT [PK_Goods_Privilege] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Goods_Reple] WITH NOCHECK ADD 
	CONSTRAINT [PK_Goods_Reple] PRIMARY KEY  CLUSTERED 
	(
		[RepleGuid]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Goods_Tag] WITH NOCHECK ADD 
	CONSTRAINT [PK_Goods_Tag] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Goods_TransactionsNote] WITH NOCHECK ADD 
	CONSTRAINT [PK_Goods_TransactionsNote] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Goods_UserPrice] WITH NOCHECK ADD 
	CONSTRAINT [PK_Goods_UserPrice] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Goods_Wholesale] WITH NOCHECK ADD 
	CONSTRAINT [PK_Goods_Wholesale] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Manager] WITH NOCHECK ADD 
	CONSTRAINT [PK_Manager] PRIMARY KEY  CLUSTERED 
	(
		[ManagerGuid]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Manager_Function] WITH NOCHECK ADD 
	CONSTRAINT [PK_Shop_Function] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Manager_Module] WITH NOCHECK ADD 
	CONSTRAINT [PK_Shop_Module] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Manager_Note] WITH NOCHECK ADD 
	CONSTRAINT [PK_Manager_Note] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Manager_Role] WITH NOCHECK ADD 
	CONSTRAINT [PK_Role] PRIMARY KEY  CLUSTERED 
	(
		[RoleGuid]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Notice] WITH NOCHECK ADD 
	CONSTRAINT [PK_Notice] PRIMARY KEY  CLUSTERED 
	(
		[NoticeGuid]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[OptionGroup] WITH NOCHECK ADD 
	CONSTRAINT [PK_Goods_OptionalGroup] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[OptionGroup_Option] WITH NOCHECK ADD 
	CONSTRAINT [PK_OptionalGroup] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Order] WITH NOCHECK ADD 
	CONSTRAINT [PK_Order] PRIMARY KEY  CLUSTERED 
	(
		[OrderNumber]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Order_Goods] WITH NOCHECK ADD 
	CONSTRAINT [PK_Order_Goods] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Order_Restore] WITH NOCHECK ADD 
	CONSTRAINT [PK_Order_Restore] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Order_State] WITH NOCHECK ADD 
	CONSTRAINT [PK_Order_State] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Payment_Interface] WITH NOCHECK ADD 
	CONSTRAINT [PK_Payment_Interface] PRIMARY KEY  CLUSTERED 
	(
		[PaymentTag]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Privilege] WITH NOCHECK ADD 
	CONSTRAINT [PK_Privilege] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[ShopBBS] WITH NOCHECK ADD 
	CONSTRAINT [PK_ShopBBS] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Shop_CostomTag] WITH NOCHECK ADD 
	CONSTRAINT [PK_Shop_Tag] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Shop_Help] WITH NOCHECK ADD 
	CONSTRAINT [PK_Shop_Help] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[User] WITH NOCHECK ADD 
	CONSTRAINT [PK_User] PRIMARY KEY  CLUSTERED 
	(
		[UserGuid]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[User_Card] WITH NOCHECK ADD 
	CONSTRAINT [PK_User_Card] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[User_CardGroup] WITH NOCHECK ADD 
	CONSTRAINT [PK_User_CardGroup] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[User_Consignee] WITH NOCHECK ADD 
	CONSTRAINT [PK_User_Consignee] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[User_Coupon] WITH NOCHECK ADD 
	CONSTRAINT [PK_User_Coupon] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[User_Discuss] WITH NOCHECK ADD 
	CONSTRAINT [PK_User_Discuss] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[User_Favorite] WITH NOCHECK ADD 
	CONSTRAINT [PK_User_Favorite] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[User_Group] WITH NOCHECK ADD 
	CONSTRAINT [PK_User_Group] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[User_Message] WITH NOCHECK ADD 
	CONSTRAINT [PK_User_Message] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[User_Order] WITH NOCHECK ADD 
	CONSTRAINT [PK_User_Order] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[User_PointsNote] WITH NOCHECK ADD 
	CONSTRAINT [PK_User_PointsNote] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[User_RechargeNote] WITH NOCHECK ADD 
	CONSTRAINT [PK_User_RechargeNote] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[User_WithdrawsCash] WITH NOCHECK ADD 
	CONSTRAINT [PK_User_WithdrawsCash] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Order] WITH NOCHECK ADD 
	CONSTRAINT [DF_Order_OrderType] DEFAULT (1) FOR [OrderType]
GO

ALTER TABLE [dbo].[Article] ADD 
	CONSTRAINT [FK_Article_Article_Class] FOREIGN KEY 
	(
		[ArticleClass]
	) REFERENCES [dbo].[Article_Class] (
		[ClassGuid]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Binding_Goods] ADD 
	CONSTRAINT [FK_Binding_Goods_Binding] FOREIGN KEY 
	(
		[BindingGuid]
	) REFERENCES [dbo].[Binding] (
		[BindingGuid]
	) ON DELETE CASCADE  ON UPDATE CASCADE ,
	CONSTRAINT [FK_Binding_Goods_Goods] FOREIGN KEY 
	(
		[GoodsGuid]
	) REFERENCES [dbo].[Goods] (
		[GoodsGuid]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Distribute_Area] ADD 
	CONSTRAINT [FK_Distribute_Area_Distribute] FOREIGN KEY 
	(
		[DistributeGuid]
	) REFERENCES [dbo].[Distribute] (
		[DistributeGuid]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Goods_Analogy] ADD 
	CONSTRAINT [FK_Goods_Analogy_Goods] FOREIGN KEY 
	(
		[GoodsID]
	) REFERENCES [dbo].[Goods] (
		[GoodsGuid]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Goods_Ask] ADD 
	CONSTRAINT [FK_Goods_Ask_Goods] FOREIGN KEY 
	(
		[GoodsGuid]
	) REFERENCES [dbo].[Goods] (
		[GoodsGuid]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Goods_Assemble] ADD 
	CONSTRAINT [FK_Goods_Assemble_Goods] FOREIGN KEY 
	(
		[GoodsID]
	) REFERENCES [dbo].[Goods] (
		[GoodsGuid]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Goods_Attribute] ADD 
	CONSTRAINT [FK_Goods_Attribute_Goods] FOREIGN KEY 
	(
		[GoodsID]
	) REFERENCES [dbo].[Goods] (
		[GoodsGuid]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Goods_AttributeValue] ADD 
	CONSTRAINT [FK_Goods_AttributeValue_Goods_Attribute] FOREIGN KEY 
	(
		[AttributeID]
	) REFERENCES [dbo].[Goods_Attribute] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Goods_AttributeValueImage] ADD 
	CONSTRAINT [FK_Goods_AttributeValueImage_Goods_AttributeValue] FOREIGN KEY 
	(
		[AttributeValueID]
	) REFERENCES [dbo].[Goods_AttributeValue] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Goods_Class_Filter] ADD 
	CONSTRAINT [FK_Goods_Class_Filter_Goods_Class] FOREIGN KEY 
	(
		[ClassGuid]
	) REFERENCES [dbo].[Goods_Class] (
		[ClassGuid]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Goods_Class_FilterValue] ADD 
	CONSTRAINT [FK_Goods_Class_FilterValue_Goods_Class_Filter] FOREIGN KEY 
	(
		[FilterID]
	) REFERENCES [dbo].[Goods_Class_Filter] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Goods_Class_Hot] ADD 
	CONSTRAINT [FK_Goods_Class_Hot_Goods] FOREIGN KEY 
	(
		[GoodsID]
	) REFERENCES [dbo].[Goods] (
		[GoodsGuid]
	) ON DELETE CASCADE  ON UPDATE CASCADE ,
	CONSTRAINT [FK_Goods_Class_Hot_Goods_Class] FOREIGN KEY 
	(
		[ClassID]
	) REFERENCES [dbo].[Goods_Class] (
		[ClassGuid]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Goods_Discuss] ADD 
	CONSTRAINT [FK_Goods_Discuss_Goods] FOREIGN KEY 
	(
		[GoodsGuid]
	) REFERENCES [dbo].[Goods] (
		[GoodsGuid]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Goods_Image] ADD 
	CONSTRAINT [FK_Goods_Image_Goods] FOREIGN KEY 
	(
		[GoodsGuid]
	) REFERENCES [dbo].[Goods] (
		[GoodsGuid]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Goods_Images] ADD 
	CONSTRAINT [FK_Goods_Images_Goods] FOREIGN KEY 
	(
		[GoodsGuid]
	) REFERENCES [dbo].[Goods] (
		[GoodsGuid]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Goods_OOS] ADD 
	CONSTRAINT [FK_Goods_OOS_Goods] FOREIGN KEY 
	(
		[GoodsID]
	) REFERENCES [dbo].[Goods] (
		[GoodsGuid]
	) ON DELETE CASCADE  ON UPDATE CASCADE ,
	CONSTRAINT [FK_Goods_OOS_User] FOREIGN KEY 
	(
		[UserID]
	) REFERENCES [dbo].[User] (
		[UserGuid]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Goods_OptionGroup] ADD 
	CONSTRAINT [FK_Goods_OptionGroup_Goods] FOREIGN KEY 
	(
		[GoodsID]
	) REFERENCES [dbo].[Goods] (
		[GoodsGuid]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Goods_Parameter] ADD 
	CONSTRAINT [FK_Goods_Parameter_Goods] FOREIGN KEY 
	(
		[GoodsGuid]
	) REFERENCES [dbo].[Goods] (
		[GoodsGuid]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Goods_Privilege] ADD 
	CONSTRAINT [FK_Goods_Privilege_Goods] FOREIGN KEY 
	(
		[GoodsID]
	) REFERENCES [dbo].[Goods] (
		[GoodsGuid]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Goods_TransactionsNote] ADD 
	CONSTRAINT [FK_Goods_TransactionsNote_Goods] FOREIGN KEY 
	(
		[GoodsID]
	) REFERENCES [dbo].[Goods] (
		[GoodsGuid]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Goods_UserPrice] ADD 
	CONSTRAINT [FK_Goods_UserPrice_Goods] FOREIGN KEY 
	(
		[GoodsID]
	) REFERENCES [dbo].[Goods] (
		[GoodsGuid]
	) ON DELETE CASCADE  ON UPDATE CASCADE ,
	CONSTRAINT [FK_Goods_UserPrice_User_Group] FOREIGN KEY 
	(
		[UserGroup]
	) REFERENCES [dbo].[User_Group] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Goods_Wholesale] ADD 
	CONSTRAINT [FK_Goods_Wholesale_Goods] FOREIGN KEY 
	(
		[GoodsID]
	) REFERENCES [dbo].[Goods] (
		[GoodsGuid]
	) ON DELETE CASCADE  ON UPDATE CASCADE ,
	CONSTRAINT [FK_Goods_Wholesale_User_Group] FOREIGN KEY 
	(
		[UserGroup]
	) REFERENCES [dbo].[User_Group] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Manager_Function] ADD 
	CONSTRAINT [FK_Shop_Function_Shop_Module] FOREIGN KEY 
	(
		[ModuleNo]
	) REFERENCES [dbo].[Manager_Module] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[OptionGroup_Option] ADD 
	CONSTRAINT [FK_OptionGroup_Option_OptionGroup] FOREIGN KEY 
	(
		[GroupID]
	) REFERENCES [dbo].[OptionGroup] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Order_Goods] ADD 
	CONSTRAINT [FK_Order_Goods_Order] FOREIGN KEY 
	(
		[OrderNumber]
	) REFERENCES [dbo].[Order] (
		[OrderNumber]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Order_State] ADD 
	CONSTRAINT [FK_Order_State_Order] FOREIGN KEY 
	(
		[OrderNumber]
	) REFERENCES [dbo].[Order] (
		[OrderNumber]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[User] ADD 
	CONSTRAINT [FK_User_User_Group] FOREIGN KEY 
	(
		[UserGroup]
	) REFERENCES [dbo].[User_Group] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[User_Card] ADD 
	CONSTRAINT [FK_User_Card_User_CardGroup] FOREIGN KEY 
	(
		[GroupID]
	) REFERENCES [dbo].[User_CardGroup] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE ,
	CONSTRAINT [FK_User_Card_User_Group] FOREIGN KEY 
	(
		[GiftUserGroup]
	) REFERENCES [dbo].[User_Group] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[User_Consignee] ADD 
	CONSTRAINT [FK_User_Consignee_User] FOREIGN KEY 
	(
		[UserID]
	) REFERENCES [dbo].[User] (
		[UserGuid]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[User_Coupon] ADD 
	CONSTRAINT [FK_User_Coupon_Coupon] FOREIGN KEY 
	(
		[CouponID]
	) REFERENCES [dbo].[Coupon] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE ,
	CONSTRAINT [FK_User_Coupon_User] FOREIGN KEY 
	(
		[UserID]
	) REFERENCES [dbo].[User] (
		[UserGuid]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[User_Discuss] ADD 
	CONSTRAINT [FK_User_Discuss_Goods] FOREIGN KEY 
	(
		[GoodsID]
	) REFERENCES [dbo].[Goods] (
		[GoodsGuid]
	) ON DELETE CASCADE  ON UPDATE CASCADE ,
	CONSTRAINT [FK_User_Discuss_User] FOREIGN KEY 
	(
		[UserID]
	) REFERENCES [dbo].[User] (
		[UserGuid]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[User_Favorite] ADD 
	CONSTRAINT [FK_User_Favorite_Goods] FOREIGN KEY 
	(
		[GoodsID]
	) REFERENCES [dbo].[Goods] (
		[GoodsGuid]
	) ON DELETE CASCADE  ON UPDATE CASCADE ,
	CONSTRAINT [FK_User_Favorite_User] FOREIGN KEY 
	(
		[UserID]
	) REFERENCES [dbo].[User] (
		[UserGuid]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[User_Message] ADD 
	CONSTRAINT [FK_User_Message_User] FOREIGN KEY 
	(
		[UserGuid]
	) REFERENCES [dbo].[User] (
		[UserGuid]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[User_Order] ADD 
	CONSTRAINT [FK_User_Order_Order] FOREIGN KEY 
	(
		[OrderNumber]
	) REFERENCES [dbo].[Order] (
		[OrderNumber]
	) ON DELETE CASCADE  ON UPDATE CASCADE ,
	CONSTRAINT [FK_User_Order_User] FOREIGN KEY 
	(
		[UserGuid]
	) REFERENCES [dbo].[User] (
		[UserGuid]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[User_PointsNote] ADD 
	CONSTRAINT [FK_User_PointsNote_User] FOREIGN KEY 
	(
		[UserGuid]
	) REFERENCES [dbo].[User] (
		[UserGuid]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[User_RechargeNote] ADD 
	CONSTRAINT [FK_User_RechargeNote_User] FOREIGN KEY 
	(
		[UserGuid]
	) REFERENCES [dbo].[User] (
		[UserGuid]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[User_WithdrawsCash] ADD 
	CONSTRAINT [FK_User_WithdrawsCash_User] FOREIGN KEY 
	(
		[UserGuid]
	) REFERENCES [dbo].[User] (
		[UserGuid]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

