CREATE TABLE Addresses (AddressId int(11) NOT NULL auto_increment, PortalUserId int(11) NOT NULL default '0', To varchar(255) NOT NULL default '', Company varchar(255) NOT NULL default '', Phone varchar(255) NOT NULL default '', Fax varchar(255) NOT NULL default '', Email varchar(255) NOT NULL default '', Address1 varchar(255) NOT NULL default '', Address2 varchar(255) NOT NULL default '', City varchar(255) NOT NULL default '', State char(2) NOT NULL default '', Zip varchar(20) NOT NULL default '', Country char(3) NOT NULL default '', LastUsedAsBilling tinyint(4) unsigned NOT NULL default '0', LastUsedAsShipping tinyint(4) unsigned NOT NULL default '0', PRIMARY KEY (AddressId) ); CREATE TABLE Currencies (CurrencyId int(11) NOT NULL auto_increment, ISO char(3) NOT NULL default '', Symbol varchar(255) default NULL, SymbolPosition tinyint(4) default NULL, Name varchar(255) NOT NULL default '', RateToPrimary double NOT NULL default '1', Modified int(11) NOT NULL default '0', Status smallint(6) NOT NULL default '0', IsPrimary smallint(6) NOT NULL default '0', Priority int(11) NOT NULL default '0', PRIMARY KEY (CurrencyId) ); CREATE TABLE GatewayConfigFields (GWConfigFieldId int(11) NOT NULL auto_increment, SystemFieldName varchar(50) NOT NULL default '', FieldName varchar(100) NOT NULL default '', ElementType varchar(30) NOT NULL default 'text', ValueList mediumtext NOT NULL, GatewayId int(11) NOT NULL default '0', PRIMARY KEY (GWConfigFieldId) ); CREATE TABLE GatewayConfigValues (GWConfigValueId int(11) NOT NULL auto_increment, GWConfigFieldId int(11) NOT NULL default '0', PaymentTypeId int(11) NOT NULL default '0', Value varchar(255) default NULL, PRIMARY KEY (GWConfigValueId) ); CREATE TABLE Gateways (GatewayId int(11) NOT NULL auto_increment, Name varchar(100) NOT NULL default '', ClassName varchar(150) NOT NULL default '', ClassFile varchar(255) NOT NULL default '', RequireCCFields tinyint(4) NOT NULL default '0', PRIMARY KEY (GatewayId) ); CREATE TABLE Manufacturers (ManufacturerId int(11) NOT NULL auto_increment, Name varchar(255) NOT NULL default '', Description text NOT NULL, URL varchar(255) NOT NULL default '', PRIMARY KEY (ManufacturerId) ); CREATE TABLE OrderItems (OrderItemId int(11) NOT NULL auto_increment, OrderId int(11) NOT NULL default '0', ProductId int(11) NOT NULL default '0', ProductName varchar(255) NOT NULL default '', Quantity int(11) NOT NULL default '0', QuantityReserved int(11) default NULL, Price decimal(10,4) NOT NULL default '0.0000', BackOrderFlag tinyint(4) default '0', Weight double default NULL, ShippingTypeId varchar(255) default NULL, PRIMARY KEY (OrderItemId), KEY OrderId (OrderId) ); CREATE TABLE Orders (OrderId int(11) NOT NULL auto_increment, Number mediumint(9) NOT NULL default '0', SubNumber smallint(6) NOT NULL default '0', Status tinyint(3) unsigned NOT NULL default '0', OrderDate int(10) unsigned NOT NULL default '0', PortalUserId int(11) NOT NULL default '0', UserComment text NOT NULL, AdminComment text NOT NULL, BillingTo varchar(255) NOT NULL default '', BillingCompany varchar(255) NOT NULL default '', BillingPhone varchar(255) NOT NULL default '', BillingFax varchar(255) NOT NULL default '', BillingEmail varchar(255) NOT NULL default '', BillingAddress1 varchar(255) NOT NULL default '', BillingAddress2 varchar(255) NOT NULL default '', BillingCity varchar(255) NOT NULL default '', BillingState varchar(255) NOT NULL default '', BillingZip varchar(255) NOT NULL default '', BillingCountry varchar(255) NOT NULL default '', VAT float default NULL, VATPercent float default NULL, PaymentType tinyint(3) unsigned NOT NULL default '0', PaymentAccount varchar(255) NOT NULL default '', PaymentExpires int(10) unsigned NOT NULL default '0', PaymentNameOnCard varchar(255) NOT NULL default '', PaymentCCExpDate varchar(5) NOT NULL default '', PaymentCardType varchar(255) NOT NULL default '', ShippingTo varchar(255) NOT NULL default '', ShippingCompany varchar(255) NOT NULL default '', ShippingPhone varchar(255) NOT NULL default '', ShippingFax varchar(255) NOT NULL default '', ShippingEmail varchar(255) NOT NULL default '', ShippingAddress1 varchar(255) NOT NULL default '', ShippingAddress2 varchar(255) NOT NULL default '', ShippingCity varchar(255) NOT NULL default '', ShippingState varchar(255) NOT NULL default '', ShippingZip varchar(255) NOT NULL default '', ShippingCountry varchar(255) NOT NULL default '', ShippingType int(11) NOT NULL default '0', ShippingCost double(10,4) NOT NULL default '0.0000', ShippingCustomerAccount varchar(255) NOT NULL default '', ShippingTracking varchar(255) NOT NULL default '', ShippingDate int(11) default NULL, SubTotal float(10,4) unsigned NOT NULL default '0.0000', OriginalAmount decimal(10,4) NOT NULL default '0.0000', ShippingOption tinyint(4) default NULL, ShippingInfo text, CouponId int(11) default NULL, CouponDiscount float NOT NULL default '0', TransactionStatus tinyint(3) unsigned NOT NULL default '2', GWResult1 mediumtext NOT NULL, GWResult2 mediumtext NOT NULL, PRIMARY KEY (OrderId) ); CREATE TABLE PaymentTypeCurrencies (PaymentTypeCurrencyId int(11) NOT NULL auto_increment, PaymentTypeId int(11) NOT NULL default '0', CurrencyId int(11) NOT NULL default '0', PRIMARY KEY (PaymentTypeCurrencyId) ); CREATE TABLE PaymentTypes (PaymentTypeId int(11) NOT NULL auto_increment, Name varchar(100) NOT NULL default '', Description varchar(255) default NULL, Instructions text, AdminComments text, Status int(11) NOT NULL default '0', Priority int(11) NOT NULL default '0', IsPrimary tinyint(4) NOT NULL default '0', BuiltIn smallint(6) NOT NULL default '0', GatewayId int(11) NOT NULL default '1', PlacedOrdersEdit tinyint(4) NOT NULL default '0', PRIMARY KEY (PaymentTypeId) ); CREATE TABLE Products (ProductId int(11) NOT NULL auto_increment, Name varchar(255) NOT NULL default '', l1_Name varchar(255) default NULL, l2_Name varchar(255) default NULL, l3_Name varchar(255) default NULL, l4_Name varchar(255) default NULL, l5_Name varchar(255) default NULL, l6_Name varchar(255) default NULL, l7_Name varchar(255) default NULL, l8_Name varchar(255) default NULL, l9_Name varchar(255) default NULL, l10_Name varchar(255) default NULL, SKU varchar(255) default NULL, Type int(2) default NULL, Description text, DescriptionExcerpt text, Weight double(10,4) default NULL, ManufacturerId int(11) NOT NULL default '0', MSRP double default NULL, BackOrder int(1) default NULL, BackOrderDate int(11) default NULL, CreatedOn double NOT NULL default '0', Modified double NOT NULL default '0', Expire double NOT NULL default '0', Hits double NOT NULL default '0', CachedRating decimal(11,10) default NULL, CachedVotesQty int(11) NOT NULL default '0', CachedReviewsQty int(11) default '0', CreatedById int(11) NOT NULL default '0', ModifiedById int(11) NOT NULL default '0', Priority int(11) NOT NULL default '0', Status tinyint(4) default '0', EditorsPick tinyint(4) NOT NULL default '0', Featured tinyint(4) NOT NULL default '0', ResourceId int(11) default NULL, HotItem tinyint(4) NOT NULL default '2', PopItem tinyint(4) NOT NULL default '2', NewItem tinyint(4) NOT NULL default '2', QtyInStock int(11) default NULL, QtyInStockMin int(11) NOT NULL default '0', QtyReserved int(11) default NULL, QtyBackOrdered int(11) default NULL, QtyOnOrder int(11) default NULL, InventoryComment text, AccessGroupId int(11) default NULL, AccessDuration int(11) default NULL, AccessDurationType tinyint(4) default NULL, AccessStart int(11) default NULL, AccessEnd int(11) default NULL, PRIMARY KEY (ProductId), KEY ResourceId (ResourceId), KEY Hits (Hits), KEY Name (Name), KEY EditorsPick (EditorsPick), KEY CreatedOn (CreatedOn), KEY Modified (Modified,CreatedOn), KEY Status (Status), KEY l1_Name (l1_Name), KEY Priority (Priority), KEY ManufacturerId (ManufacturerId) ); CREATE TABLE ProductsCouponItems (CouponItemId int(11) NOT NULL auto_increment, CouponId int(11) default NULL, ItemResourceId int(11) default NULL, ItemType tinyint(4) default NULL, PRIMARY KEY (CouponItemId), KEY DiscountId (CouponId), KEY ItemResourceId (ItemResourceId), KEY ItemType (ItemType) ); CREATE TABLE ProductsCoupons (CouponId int(11) NOT NULL auto_increment, Status tinyint(4) default NULL, Name varchar(255) default NULL, Code varchar(255) default NULL, Expiration int(11) default NULL, GroupId int(11) default NULL, Type tinyint(1) default NULL, Amount double default NULL, LastUsedBy int(11) default NULL, LastUsedOn int(11) default NULL, NumberOfUses int(11) default NULL, PRIMARY KEY (CouponId), KEY Status (Status) ); CREATE TABLE ProductsDiscountItems (DiscountItemId int(11) NOT NULL auto_increment, DiscountId int(11) default NULL, ItemResourceId int(11) default NULL, ItemType tinyint(4) default NULL, PRIMARY KEY (DiscountItemId), KEY DiscountId (DiscountId), KEY ItemResourceId (ItemResourceId), KEY ItemType (ItemType) ); CREATE TABLE ProductsDiscounts (DiscountId int(11) NOT NULL auto_increment, Status tinyint(4) default NULL, Name varchar(255) default NULL, Start int(11) default NULL, End int(11) default NULL, GroupId int(11) default NULL, Type tinyint(1) default NULL, Amount double default NULL, PRIMARY KEY (DiscountId), KEY Status (Status) ); CREATE TABLE ProductsPricing (PriceId int(11) NOT NULL auto_increment, ProductId int(11) NOT NULL default '0', MinQty int(11) default NULL, MaxQty int(11) default NULL, Cost double default NULL, Price double default NULL, Negotiated tinyint(1) default NULL, Points int(11) default NULL, UnitsLimit double default NULL, Description varchar(255) default NULL, IsPrimary tinyint(4) NOT NULL default '0', PRIMARY KEY (PriceId), KEY ProductId (ProductId) ); CREATE TABLE ShippingBrackets (BracketId int(11) NOT NULL auto_increment, ShippingTypeID int(11) NOT NULL default '0', Start int(11) NOT NULL default '0', End int(11) NOT NULL default '0', PRIMARY KEY (BracketId), KEY ShippingTypeID (ShippingTypeID), KEY Start (Start), KEY End (End) ); CREATE TABLE ShippingCosts (ShippingCostId int(11) NOT NULL auto_increment, ZoneID int(11) NOT NULL default '0', BracketId int(11) NOT NULL default '0', Flat decimal(10,4) default NULL, PerUnit decimal(10,4) default NULL, PRIMARY KEY (ShippingCostId), KEY ZoneID (ZoneID), KEY BracketId (BracketId) ); CREATE TABLE ShippingQuoteEngines (EngineId int(11) NOT NULL auto_increment, Name varchar(255) NOT NULL default '', FlatSurcharge double NOT NULL default '0', PercentSurcharge double NOT NULL default '0', Status smallint(6) NOT NULL default '0', Properties text NOT NULL, ClassName varchar(255) NOT NULL default '', PRIMARY KEY (EngineId) ); CREATE TABLE ShippingType (ShippingID int(11) NOT NULL auto_increment, Code varchar(25) NOT NULL default '', Name varchar(100) NOT NULL default '', SpeedCode varchar(25) NOT NULL default '', LocationFrom int(11) default '0', Type int(11) default '0', BaseFee double NOT NULL default '0', CODFlatSurcharge double NOT NULL default '0', CODPercentSurcharge double NOT NULL default '0', Status tinyint(4) NOT NULL default '0', CostType tinyint(4) NOT NULL default '0', ZeroIfEmpty tinyint(4) NOT NULL default '0', PrecisionBeforeSep tinyint(4) NOT NULL default '0', PrecisionAfterSep tinyint(4) NOT NULL default '0', PRIMARY KEY (ShippingID), KEY Type (Type) ); CREATE TABLE ShippingZones (ZoneID int(11) NOT NULL auto_increment, ShippingTypeID int(11) NOT NULL default '0', Name varchar(100) NOT NULL default '', Type int(11) NOT NULL default '1', CODallowed smallint(6) NOT NULL default '0', PRIMARY KEY (ZoneID), KEY ShippingTypeID (ShippingTypeID), KEY Type (Type) ); CREATE TABLE ShippingZonesDestinations (ZoneDestId int(11) NOT NULL auto_increment, ShippingZoneId int(11) NOT NULL default '0', StdDestId int(11) default '0', DestValue varchar(255) default NULL, PRIMARY KEY (ZoneDestId), KEY ShippingZoneId (ShippingZoneId), KEY StdDestId (StdDestId) ); CREATE TABLE StdDestinations (DestId int(11) NOT NULL auto_increment, DestType int(11) NOT NULL default '0', DestParentId int(11) default NULL, DestName varchar(255) NOT NULL default '', DestAbbr char(3) NOT NULL default '', DestAbbr2 char(2) default '', PRIMARY KEY (DestId) ); CREATE TABLE TaxZones (TaxZoneId int(11) NOT NULL auto_increment, Name varchar(100) NOT NULL default '', Type int(11) NOT NULL default '1', TaxValue double NOT NULL default '0', PRIMARY KEY (TaxZoneId) ); CREATE TABLE TaxZonesDestinations (TaxZoneDestId int(11) NOT NULL auto_increment, TaxZoneId int(11) NOT NULL default '0', StdDestId int(11) default '0', DestValue varchar(255) default NULL, PRIMARY KEY (TaxZoneDestId) ); UPDATE Modules SET Version = '1.0.0' WHERE Name = 'In-Commerce';