
ALTER TABLE [dbo].[bvc_Affiliate] DROP
CONSTRAINT [FK_bvc_Affiliate_bvc_Address]
GO

ALTER TABLE [dbo].[bvc_Manufacturer] DROP
CONSTRAINT [FK_bvc_Manufacturer_bvc_Address]
GO

ALTER TABLE [dbo].[bvc_Vendor] DROP
CONSTRAINT [FK_bvc_Vendor_bvc_Address]
GO

ALTER TABLE [dbo].[bvc_Affiliate] DROP CONSTRAINT [DF_affiliates_addressID]
GO

ALTER TABLE [dbo].[bvc_Manufacturer] DROP CONSTRAINT [DF_Manufacturer_AddressID]
GO

ALTER TABLE [dbo].[bvc_Order] DROP CONSTRAINT [DF_orders_BillingAddressID]
GO

ALTER TABLE [dbo].[bvc_Package] DROP CONSTRAINT [DF_Packages_SourceAddressID]
GO

ALTER TABLE [dbo].[bvc_Package] DROP CONSTRAINT [DF_Packages_DestinationAddressID]
GO

ALTER TABLE [dbo].[bvc_Vendor] DROP CONSTRAINT [DF_Vendor_AddressID]
GO

CREATE TABLE [dbo].[bvc_FraudCheckDomain]
(
[DomainName] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
)

GO

ALTER TABLE [dbo].[bvc_FraudCheckDomain] ADD CONSTRAINT [PK_bvc_FraudCheckDomain] PRIMARY KEY CLUSTERED  ([DomainName])
GO

CREATE TABLE [dbo].[bvc_FraudCheckIP]
(
[IPAddress] [nvarchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
)

GO

ALTER TABLE [dbo].[bvc_FraudCheckIP] ADD CONSTRAINT [PK_bvc_FraudCheckIP] PRIMARY KEY CLUSTERED  ([IPAddress])
GO

ALTER TABLE [dbo].[bvc_Manufacturer] ADD
[Address] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL
/*ALTER TABLE [dbo].[bvc_Manufacturer] DROP
COLUMN [AddressID]*/
GO

CREATE TABLE [dbo].[bvc_FraudCheckEmail]
(
[EmailAddress] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
)

GO

ALTER TABLE [dbo].[bvc_FraudCheckEmail] ADD CONSTRAINT [PK_bvc_FraudCheckEmail] PRIMARY KEY CLUSTERED  ([EmailAddress])
GO

ALTER TABLE [dbo].[bvc_Vendor] ADD
[Address] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL
/*ALTER TABLE [dbo].[bvc_Vendor] DROP
COLUMN [AddressID]*/
GO

ALTER TABLE [dbo].[bvc_OrderPayment] ADD
[AuthorizationOnly] [int] NOT NULL CONSTRAINT [DF_bvc_OrderPayment_AuthorizationOnly] DEFAULT (0)
GO

ALTER TABLE [dbo].[bvc_User] ADD
[AddressBook] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL
GO

ALTER TABLE [dbo].[bvc_ProductChoices_Item] ADD
[ShippingCostAdjustment] [float] NOT NULL CONSTRAINT [DF_bvc_ProductChoices_Item_ShippingCostAdjustment] DEFAULT (0),
[WeightAdjustment] [float] NOT NULL CONSTRAINT [DF_bvc_ProductChoices_Item_WeightAdjustment] DEFAULT (0),
[NullItem] [int] NOT NULL CONSTRAINT [DF_bvc_ProductChoices_Item_NullItem] DEFAULT (0)
GO

ALTER TABLE [dbo].[bvc_Package] ADD
[SourceAddress] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[DestinationAddress] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL
/*ALTER TABLE [dbo].[bvc_Package] DROP
COLUMN [SourceAddressID],
COLUMN [DestinationAddressID]*/
GO

ALTER TABLE [dbo].[bvc_OrderItem] ADD
[ShippingCost] [float] NOT NULL CONSTRAINT [DF_bvc_OrderItem_ShippingCost] DEFAULT (0),
[QtyShipped] [int] NOT NULL CONSTRAINT [DF_bvc_OrderItem_QtyShipped] DEFAULT (0),
[QtyReturned] [int] NOT NULL CONSTRAINT [DF_bvc_OrderItem_QtyReturned] DEFAULT (0),
[ParentID] [int] NOT NULL CONSTRAINT [DF_bvc_OrderItem_ParentID] DEFAULT (0)
GO

ALTER TABLE [dbo].[bvc_Order] ADD
[BillingAddress] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[ShippingStatus] [int] NOT NULL CONSTRAINT [DF_bvc_Order_ShippingStatus] DEFAULT (0)
/*ALTER TABLE [dbo].[bvc_Order] DROP
COLUMN [BillingAddressID]*/
GO

ALTER TABLE [dbo].[bvc_Product] ADD
[ExtraShipFee] [decimal] (18, 0) NOT NULL CONSTRAINT [DF_bvc_Product_ExtraShipFee] DEFAULT (0)
GO

ALTER TABLE [dbo].[bvc_Affiliate] ADD
[Address] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[StyleSheet] [nvarchar] (1000) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL CONSTRAINT [DF_bvc_Affiliate_StyleSheet] DEFAULT ('')
/*ALTER TABLE [dbo].[bvc_Affiliate] DROP
COLUMN [AddressID]*/
GO

ALTER TABLE [dbo].[bvc_Discount] ADD
[ShipMethodID] [int] NOT NULL CONSTRAINT [DF_bvc_Discount_LimitToShipMethod] DEFAULT (0)
GO

ALTER TABLE [dbo].[bvc_ProductInventory] ADD
[SKU] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
GO

CREATE TABLE [dbo].[bvc_MerchantFeedProducts]
(
[ID] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[FroogleFeed] [int] NOT NULL
)
GO


EXEC sp_addextendedproperty N'MS_Description', N'Ship Method ID (0 = all)', 'USER', N'dbo', 'TABLE', N'bvc_Discount', 'COLUMN', N'ShipMethodID'
GO

EXEC sp_addextendedproperty N'MS_Description', N'Any per item shipping costs', 'USER', N'dbo', 'TABLE', N'bvc_OrderItem', 'COLUMN', N'ShippingCost'
GO

EXEC sp_addextendedproperty N'MS_Description', N'ParentItem ID', 'USER', N'dbo', 'TABLE', N'bvc_OrderItem', 'COLUMN', N'ParentID'
GO

EXEC sp_addextendedproperty N'MS_Description', N'0 = false, 1 = true', 'USER', N'dbo', 'TABLE', N'bvc_OrderPayment', 'COLUMN', N'AuthorizationOnly'
GO

EXEC sp_addextendedproperty N'MS_Description', N'1 = Yes, 0 = No', 'USER', N'dbo', 'TABLE', N'bvc_ProductChoices_Item', 'COLUMN', N'NullItem'
GO
