Index: branches/5.0.x/in-commerce/install/install_schema.sql
===================================================================
diff -u -r12674 -r12699
--- branches/5.0.x/in-commerce/install/install_schema.sql	(.../install_schema.sql)	(revision 12674)
+++ branches/5.0.x/in-commerce/install/install_schema.sql	(.../install_schema.sql)	(revision 12699)
@@ -23,30 +23,30 @@
 );
 
 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),
+  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) DEFAULT NULL,
+  `Status` smallint(6) NOT NULL DEFAULT '1',
+  IsPrimary smallint(6) NOT NULL DEFAULT '0',
+  Priority int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (CurrencyId),
   KEY Priority (Priority),
   KEY IsPrimary (IsPrimary),
   KEY Modified (Modified)
 );
 
 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),
+  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,
+  GatewayId int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (GWConfigFieldId),
   KEY GatewayId (GatewayId)
 );
 
@@ -70,22 +70,22 @@
 );
 
 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 '',
-  Logo varchar(255) NOT NULL default '',
-  IsPopular int(10) unsigned NOT NULL default '0',
-  Address1 varchar(255) default NULL,
-  Address2 varchar(255) default NULL,
-  City varchar(255) default NULL,
-  State varchar(50) default NULL,
-  Zip varchar(50) default NULL,
-  Country varchar(255) default NULL,
-  Phone varchar(50) default NULL,
-  Fax varchar(50) default NULL,
-  Email varchar(255) default NULL,
-  PRIMARY KEY  (ManufacturerId)
+  ManufacturerId int(11) NOT NULL AUTO_INCREMENT,
+  `Name` varchar(255) NOT NULL DEFAULT '',
+  Description text,
+  URL varchar(255) NOT NULL DEFAULT '',
+  Logo varchar(255) NOT NULL DEFAULT '',
+  IsPopular int(10) unsigned NOT NULL DEFAULT '0',
+  Address1 varchar(255) DEFAULT NULL,
+  Address2 varchar(255) DEFAULT NULL,
+  City varchar(255) DEFAULT NULL,
+  State varchar(50) DEFAULT NULL,
+  Zip varchar(50) DEFAULT NULL,
+  Country varchar(255) DEFAULT NULL,
+  Phone varchar(50) DEFAULT NULL,
+  Fax varchar(50) DEFAULT NULL,
+  Email varchar(255) DEFAULT NULL,
+  PRIMARY KEY (ManufacturerId)
 );
 
 CREATE TABLE OrderItems (
@@ -122,79 +122,79 @@
 );
 
 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',
-  OnHold tinyint(3) unsigned NOT NULL default '0',
-  OrderDate int(10) unsigned NOT NULL default '0',
-  PortalUserId int(11) NOT NULL default '-1',
-  OrderIP varchar(30) NOT NULL default '',
-  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 'USA',
-  VAT decimal(20,4) NOT NULL default '0.0000',
-  VATPercent decimal(20,4) NOT NULL default '0.0000',
-  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 'USA',
-  ShippingType int(11) NOT NULL default '0',
-  ShippingCost decimal(20,4) NOT NULL default '0.0000',
-  ShippingCustomerAccount varchar(255) NOT NULL default '',
-  ShippingTracking varchar(255) NOT NULL default '',
-  ShippingDate int(11) default NULL,
-  SubTotal decimal(20,4) unsigned NOT NULL default '0.0000',
-  ReturnTotal decimal(20,4) NOT NULL default '0.0000',
-  CostTotal decimal(20,4) NOT NULL default '0.0000',
-  OriginalAmount decimal(20,4) NOT NULL default '0.0000',
-  ShippingOption tinyint(4) default NULL,
+  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',
+  OnHold tinyint(3) unsigned NOT NULL DEFAULT '0',
+  OrderDate int(10) unsigned DEFAULT NULL,
+  PortalUserId int(11) NOT NULL DEFAULT '-1',
+  OrderIP varchar(30) NOT NULL DEFAULT '',
+  UserComment text,
+  AdminComment text,
+  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 'USA',
+  VAT decimal(20,4) NOT NULL DEFAULT '0.0000',
+  VATPercent decimal(20,4) NOT NULL DEFAULT '0.0000',
+  PaymentType tinyint(3) unsigned NOT NULL DEFAULT '0',
+  PaymentAccount varchar(255) NOT NULL DEFAULT '',
+  PaymentExpires int(10) unsigned DEFAULT NULL,
+  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 'USA',
+  ShippingType int(11) NOT NULL DEFAULT '0',
+  ShippingCost decimal(20,4) NOT NULL DEFAULT '0.0000',
+  ShippingCustomerAccount varchar(255) NOT NULL DEFAULT '',
+  ShippingTracking varchar(255) NOT NULL DEFAULT '',
+  ShippingDate int(11) DEFAULT NULL,
+  SubTotal decimal(20,4) unsigned NOT NULL DEFAULT '0.0000',
+  ReturnTotal decimal(20,4) NOT NULL DEFAULT '0.0000',
+  CostTotal decimal(20,4) NOT NULL DEFAULT '0.0000',
+  OriginalAmount decimal(20,4) NOT NULL DEFAULT '0.0000',
+  ShippingOption tinyint(4) DEFAULT NULL,
   ShippingInfo text,
-  CouponId int(11) default NULL,
-  CouponDiscount decimal(20,4) NOT NULL default '0.0000',
-  DiscountTotal decimal(10,4) NOT NULL default '0.0000',
-  TransactionStatus tinyint(3) unsigned NOT NULL default '2',
-  GWResult1 mediumtext NOT NULL,
-  GWResult2 mediumtext NOT NULL,
-  AffiliateId int(10) unsigned NOT NULL default '0',
-  VisitId int(10) unsigned NOT NULL default '0',
-  AffiliateCommission decimal(10,4) NOT NULL default '0.0000',
-  ProcessingFee decimal(20,4) default '0.0000',
-  InsuranceFee decimal(20,4) NOT NULL default '0.0000',
-  ShippingTaxable tinyint(1) NOT NULL default '0',
-  ProcessingTaxable tinyint(1) NOT NULL default '0',
-  IsRecurringBilling tinyint(4) NOT NULL default '0',
-  NextCharge int(10) unsigned default NULL,
-  GroupId int(10) unsigned NOT NULL default '0',
-  ChargeOnNextApprove tinyint(4) NOT NULL default '0',
-  ShippingGroupOption tinyint(4) NOT NULL default '0',
-  GiftCertificateId int(11) default NULL,
-  GiftCertificateDiscount decimal(20,4) NOT NULL default '0.0000',
-  GoogleOrderNumber bigint(20) unsigned default NULL,
-  PRIMARY KEY  (OrderId),
+  CouponId int(11) DEFAULT NULL,
+  CouponDiscount decimal(20,4) NOT NULL DEFAULT '0.0000',
+  DiscountTotal decimal(10,4) NOT NULL DEFAULT '0.0000',
+  TransactionStatus tinyint(3) unsigned NOT NULL DEFAULT '2',
+  GWResult1 mediumtext,
+  GWResult2 mediumtext,
+  AffiliateId int(10) unsigned NOT NULL DEFAULT '0',
+  VisitId int(10) unsigned NOT NULL DEFAULT '0',
+  AffiliateCommission decimal(10,4) NOT NULL DEFAULT '0.0000',
+  ProcessingFee decimal(20,4) DEFAULT '0.0000',
+  InsuranceFee decimal(20,4) NOT NULL DEFAULT '0.0000',
+  ShippingTaxable tinyint(1) NOT NULL DEFAULT '0',
+  ProcessingTaxable tinyint(1) NOT NULL DEFAULT '0',
+  IsRecurringBilling tinyint(4) NOT NULL DEFAULT '0',
+  NextCharge int(10) unsigned DEFAULT NULL,
+  GroupId int(10) unsigned NOT NULL DEFAULT '0',
+  ChargeOnNextApprove tinyint(4) NOT NULL DEFAULT '0',
+  ShippingGroupOption tinyint(4) NOT NULL DEFAULT '0',
+  GiftCertificateId int(11) DEFAULT NULL,
+  GiftCertificateDiscount decimal(20,4) NOT NULL DEFAULT '0.0000',
+  GoogleOrderNumber bigint(20) unsigned DEFAULT NULL,
+  PRIMARY KEY (OrderId),
   KEY AffiliateId (AffiliateId),
   KEY VisitId (VisitId),
   KEY GoogleOrderNumber (GoogleOrderNumber),
@@ -209,30 +209,30 @@
 );
 
 CREATE TABLE GiftCertificates (
-  GiftCertificateId int(11) NOT NULL auto_increment,
-  OrderId int(11) default '0',
-  Purchaser varchar(64) default NULL,
-  Recipient varchar(64) default NULL,
-  SendVia tinyint(1) NOT NULL default '0',
-  RecipientEmail varchar(64) NOT NULL default '',
-  RecipientFirstname varchar(128) default NULL,
-  RecipientLastname varchar(128) default NULL,
-  RecipientAddress1 varchar(255) default NULL,
-  RecipientAddress2 varchar(255) default NULL,
-  RecipientCity varchar(64) default NULL,
-  RecipientState varchar(32) default NULL,
-  RecipientZipcode varchar(32) default NULL,
-  RecipientCountry char(3) NOT NULL default 'USA',
-  RecipientPhone varchar(32) default NULL,
+  GiftCertificateId int(11) NOT NULL AUTO_INCREMENT,
+  OrderId int(11) DEFAULT '0',
+  Purchaser varchar(64) DEFAULT NULL,
+  Recipient varchar(64) DEFAULT NULL,
+  SendVia tinyint(1) NOT NULL DEFAULT '0',
+  RecipientEmail varchar(64) NOT NULL DEFAULT '',
+  RecipientFirstname varchar(128) DEFAULT NULL,
+  RecipientLastname varchar(128) DEFAULT NULL,
+  RecipientAddress1 varchar(255) DEFAULT NULL,
+  RecipientAddress2 varchar(255) DEFAULT NULL,
+  RecipientCity varchar(64) DEFAULT NULL,
+  RecipientState varchar(32) DEFAULT NULL,
+  RecipientZipcode varchar(32) DEFAULT NULL,
+  RecipientCountry char(3) NOT NULL DEFAULT 'USA',
+  RecipientPhone varchar(32) DEFAULT NULL,
   Message text,
-  Amount decimal(12,2) default '0.00',
-  Debit decimal(12,2) default '0.00',
-  `Status` tinyint(1) NOT NULL default '1',
-  AddDate int(11) default '0',
-  Expiration int(11) default NULL,
-  Code varchar(255) default NULL,
-  PRIMARY KEY  (GiftCertificateId),
-  UNIQUE KEY Code (Code),
+  Amount decimal(12,2) DEFAULT '0.00',
+  Debit decimal(12,2) DEFAULT '0.00',
+  `Status` tinyint(1) NOT NULL DEFAULT '2',
+  AddDate int(11) DEFAULT '0',
+  Expiration int(11) DEFAULT NULL,
+  `Code` varchar(255) DEFAULT NULL,
+  PRIMARY KEY (GiftCertificateId),
+  UNIQUE KEY `Code` (`Code`),
   KEY OrderId (OrderId),
   KEY `Status` (`Status`),
   KEY AddDate (AddDate)
@@ -248,38 +248,38 @@
 );
 
 CREATE TABLE PaymentTypes (
-  PaymentTypeId int(11) NOT NULL auto_increment,
-  Name varchar(100) NOT NULL default '',
-  Description varchar(255) default NULL,
+  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',
-  ProcessingFee DOUBLE NOT NULL DEFAULT '0',
-  PortalGroups TEXT NOT NULL,
-  PRIMARY KEY  (PaymentTypeId),
-  KEY Status (Status),
+  `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',
+  ProcessingFee double NOT NULL DEFAULT '0',
+  PortalGroups text,
+  PRIMARY KEY (PaymentTypeId),
+  KEY `Status` (`Status`),
   KEY Priority (Priority),
   KEY GatewayId (GatewayId),
   KEY BuiltIn (BuiltIn),
   KEY IsPrimary (IsPrimary)
 );
 
 CREATE TABLE Products (
-  ProductId int(11) NOT NULL auto_increment,
-  Name varchar(255) 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,
-  AutomaticFilename tinyint(3) unsigned NOT NULL default '1',
-  SKU varchar(255) default NULL,
-  `Type` tinyint(2) unsigned NOT NULL default '1',
+  ProductId int(11) NOT NULL AUTO_INCREMENT,
+  `Name` varchar(255) 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,
+  AutomaticFilename tinyint(3) unsigned NOT NULL DEFAULT '1',
+  SKU varchar(255) DEFAULT NULL,
+  `Type` tinyint(2) unsigned NOT NULL DEFAULT '1',
   Description text,
   l1_Description text,
   l2_Description text,
@@ -292,57 +292,57 @@
   l3_DescriptionExcerpt text,
   l4_DescriptionExcerpt text,
   l5_DescriptionExcerpt text,
-  Weight double(10,4) default NULL,
-  ManufacturerId int(11) NOT NULL default '0',
-  MSRP double default NULL,
-  BackOrder tinyint(3) unsigned NOT NULL default '2',
-  BackOrderDate int(11) default NULL,
-  CreatedOn int(10) unsigned default NULL,
-  Modified int(10) unsigned default NULL,
-  Expire int(10) unsigned default NULL,
-  Hits double NOT NULL default '0',
-  CachedRating decimal(11,10) NOT NULL default '0.0000000000',
-  CachedVotesQty int(11) NOT NULL default '0',
-  CachedReviewsQty int(11) NOT NULL 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) NOT NULL default '2',
-  EditorsPick tinyint(4) NOT NULL default '0',
-  Featured tinyint(4) NOT NULL default '0',
-  OnSale tinyint(1) 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',
-  InventoryStatus tinyint(4) NOT NULL default '0',
-  QtyInStock int(11) NOT NULL default '0',
-  QtyInStockMin int(11) NOT NULL default '0',
-  QtyReserved int(11) NOT NULL default '0',
-  QtyBackOrdered int(11) NOT NULL default '0',
-  QtyOnOrder int(11) NOT NULL default '0',
+  Weight double(10,4) DEFAULT NULL,
+  ManufacturerId int(11) NOT NULL DEFAULT '0',
+  MSRP double DEFAULT NULL,
+  BackOrder tinyint(3) unsigned NOT NULL DEFAULT '2',
+  BackOrderDate int(11) DEFAULT NULL,
+  CreatedOn int(10) unsigned DEFAULT NULL,
+  Modified int(10) unsigned DEFAULT NULL,
+  Expire int(10) unsigned DEFAULT NULL,
+  Hits double NOT NULL DEFAULT '0',
+  CachedRating decimal(11,10) NOT NULL DEFAULT '0.0000000000',
+  CachedVotesQty int(11) NOT NULL DEFAULT '0',
+  CachedReviewsQty int(11) NOT NULL 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) NOT NULL DEFAULT '2',
+  EditorsPick tinyint(4) NOT NULL DEFAULT '0',
+  Featured tinyint(4) NOT NULL DEFAULT '0',
+  OnSale tinyint(1) 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',
+  InventoryStatus tinyint(4) NOT NULL DEFAULT '0',
+  QtyInStock int(11) NOT NULL DEFAULT '0',
+  QtyInStockMin int(11) NOT NULL DEFAULT '0',
+  QtyReserved int(11) NOT NULL DEFAULT '0',
+  QtyBackOrdered int(11) NOT NULL DEFAULT '0',
+  QtyOnOrder int(11) NOT NULL DEFAULT '0',
   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,
-  Virtual tinyint(4) NOT NULL default '0',
+  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,
+  Virtual tinyint(4) NOT NULL DEFAULT '0',
   ProcessingData text,
   PackageContent mediumtext NOT NULL,
-  OptionsSelectionMode tinyint(4) default '0',
-  HasRequiredOptions tinyint(1) NOT NULL default '0',
-  IsRecurringBilling tinyint(3) unsigned NOT NULL default '0',
-  ShippingMode tinyint(1) NOT NULL default '0',
-  ShippingLimitation text NOT NULL,
-  AssignedCoupon int(11) NOT NULL default '0',
-  MinQtyFreePromoShipping int(11) NOT NULL default '0',
-  MetaKeywords varchar(255) default NULL,
+  OptionsSelectionMode tinyint(4) DEFAULT '0',
+  HasRequiredOptions tinyint(1) NOT NULL DEFAULT '0',
+  IsRecurringBilling tinyint(3) unsigned NOT NULL DEFAULT '0',
+  ShippingMode tinyint(1) NOT NULL DEFAULT '0',
+  ShippingLimitation text,
+  AssignedCoupon int(11) NOT NULL DEFAULT '0',
+  MinQtyFreePromoShipping int(11) NOT NULL DEFAULT '0',
+  MetaKeywords varchar(255) DEFAULT NULL,
   MetaDescription text,
-  PRIMARY KEY  (ProductId),
+  PRIMARY KEY (ProductId),
   KEY ResourceId (ResourceId),
   KEY Hits (Hits),
-  KEY Name (Name),
+  KEY `Name` (`Name`),
   KEY EditorsPick (EditorsPick),
   KEY CreatedOn (CreatedOn),
   KEY Modified (Modified,CreatedOn),
@@ -433,47 +433,47 @@
 );
 
 CREATE TABLE ProductFiles (
-  FileId INT NOT NULL AUTO_INCREMENT,
-  ProductId INT NOT NULL,
-  Name VARCHAR(255) NOT NULL,
-  Version VARCHAR(100) NOT NULL,
-  FilePath VARCHAR(255) NOT NULL,
-  RealPath VARCHAR(255) NOT NULL,
-  Size INT NOT NULL,
-  Status tinyint(4) NOT NULL default '0',
-  IsPrimary tinyint(4) NOT NULL default '0',
-  Priority smallint(6) NOT NULL default '0',
-  AddedOn int(11) NOT NULL default '0',
-  AddedById int(11) NOT NULL default '0',
-  MIMEType varchar(255) NOT NULL default '',
+  FileId int(11) NOT NULL AUTO_INCREMENT,
+  ProductId int(11) NOT NULL DEFAULT '0',
+  `Name` varchar(255) NOT NULL DEFAULT '',
+  Version varchar(100) NOT NULL DEFAULT '',
+  FilePath varchar(255) NOT NULL DEFAULT '',
+  RealPath varchar(255) NOT NULL DEFAULT '',
+  Size int(11) NOT NULL DEFAULT '0',
+  `Status` tinyint(4) NOT NULL DEFAULT '0',
+  IsPrimary tinyint(4) NOT NULL DEFAULT '0',
+  Priority smallint(6) NOT NULL DEFAULT '0',
+  AddedOn int(11) DEFAULT NULL,
+  AddedById int(11) NOT NULL DEFAULT '0',
+  MIMEType varchar(255) NOT NULL DEFAULT '',
   PRIMARY KEY (FileId),
   KEY ProductId (ProductId),
-  KEY Status (Status),
+  KEY `Status` (`Status`),
   KEY IsPrimary (IsPrimary),
   KEY Priority (Priority),
   KEY AddedOn (AddedOn)
 );
 
 CREATE TABLE UserFileAccess (
-  FileAccessId INT NOT NULL AUTO_INCREMENT,
-  ProductId INT NOT NULL,
-  PortalUserId INT NOT NULL,
+  FileAccessId int(11) NOT NULL AUTO_INCREMENT,
+  ProductId int(11) NOT NULL DEFAULT '0',
+  PortalUserId int(11) NOT NULL DEFAULT '0',
   PRIMARY KEY (FileAccessId),
   KEY ProductId (ProductId),
   KEY PortalUserId (PortalUserId)
 );
 
 CREATE TABLE UserDownloads (
-  DownloadId int(11) NOT NULL auto_increment,
-  PortalUserId int(11) NOT NULL default '0',
-  Username varchar(255) NOT NULL default '',
-  ProductId int(11) NOT NULL default '0',
-  ProductName varchar(255) NOT NULL default '',
-  FileId int(11) NOT NULL default '0',
-  Filename varchar(255) NOT NULL default '',
-  IPAddress varchar(100) NOT NULL default '',
-  StartedOn int(11) NOT NULL default '0',
-  EndedOn int(11) NOT NULL default '0',
+  DownloadId int(11) NOT NULL AUTO_INCREMENT,
+  PortalUserId int(11) NOT NULL DEFAULT '0',
+  Username varchar(255) NOT NULL DEFAULT '',
+  ProductId int(11) NOT NULL DEFAULT '0',
+  ProductName varchar(255) NOT NULL DEFAULT '',
+  FileId int(11) NOT NULL DEFAULT '0',
+  Filename varchar(255) NOT NULL DEFAULT '',
+  IPAddress varchar(100) NOT NULL DEFAULT '',
+  StartedOn int(11) DEFAULT NULL,
+  EndedOn int(11) DEFAULT NULL,
   PRIMARY KEY (DownloadId),
   KEY PortalUserId (PortalUserId),
   KEY ProductId (ProductId)
@@ -502,40 +502,40 @@
 );
 
 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 '',
+  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,
+  ClassName varchar(255) NOT NULL DEFAULT '',
   PRIMARY KEY (EngineId),
-  KEY Status (Status)
+  KEY `Status` (`Status`)
 );
 
 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) NOT NULL default '1',
-  `Type` int(11) NOT NULL default '1',
-  BaseFee double NOT NULL default '0',
-  CODFlatSurcharge double NOT NULL default '0',
-  CODPercentSurcharge double NOT NULL default '0',
-  `Status` tinyint(4) NOT NULL default '1',
-  CostType tinyint(4) NOT NULL default '1',
-  ZeroIfEmpty tinyint(4) NOT NULL default '1',
-  PrecisionBeforeSep tinyint(4) NOT NULL default '2',
-  PrecisionAfterSep tinyint(4) NOT NULL default '2',
-  PortalGroups text NOT NULL,
-  FreeShippingMinAmount double(10,4) NOT NULL default '0.0000',
-  IsFreePromoShipping tinyint(1) NOT NULL default '0',
-  InsuranceFee decimal(10,2) default NULL,
-  InsuranceType tinyint(1) NOT NULL default '2',
-  PRIMARY KEY  (ShippingID),
+  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) NOT NULL DEFAULT '1',
+  `Type` int(11) NOT NULL DEFAULT '1',
+  BaseFee double NOT NULL DEFAULT '0',
+  CODFlatSurcharge double NOT NULL DEFAULT '0',
+  CODPercentSurcharge double NOT NULL DEFAULT '0',
+  `Status` tinyint(4) NOT NULL DEFAULT '1',
+  CostType tinyint(4) NOT NULL DEFAULT '1',
+  ZeroIfEmpty tinyint(4) NOT NULL DEFAULT '1',
+  PrecisionBeforeSep tinyint(4) NOT NULL DEFAULT '2',
+  PrecisionAfterSep tinyint(4) NOT NULL DEFAULT '2',
+  PortalGroups text,
+  FreeShippingMinAmount double(10,4) NOT NULL DEFAULT '0.0000',
+  IsFreePromoShipping tinyint(1) NOT NULL DEFAULT '0',
+  InsuranceFee decimal(10,2) DEFAULT NULL,
+  InsuranceType tinyint(1) NOT NULL DEFAULT '2',
+  PRIMARY KEY (ShippingID),
   KEY `Type` (`Type`),
-  KEY Status (Status)
+  KEY `Status` (`Status`)
 );
 
 CREATE TABLE ShippingZones (
@@ -580,29 +580,29 @@
 );
 
 CREATE TABLE AffiliatePayments (
-  AffiliatePaymentId int(11) NOT NULL auto_increment,
-  AffiliateId int(10) unsigned NOT NULL default '0',
-  PaymentDate int(10) unsigned NOT NULL default '0',
-  Amount decimal(10,2) NOT NULL default '0.00',
-  Comment text NOT NULL,
-  PaymentReference varchar(255) NOT NULL default '',
-  PaymentTypeId int(11) NOT NULL default '0',
-  PRIMARY KEY  (AffiliatePaymentId),
+  AffiliatePaymentId int(11) NOT NULL AUTO_INCREMENT,
+  AffiliateId int(10) unsigned NOT NULL DEFAULT '0',
+  PaymentDate int(10) unsigned DEFAULT NULL,
+  Amount decimal(10,2) NOT NULL DEFAULT '0.00',
+  `Comment` text,
+  PaymentReference varchar(255) NOT NULL DEFAULT '',
+  PaymentTypeId int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (AffiliatePaymentId),
   KEY AffiliateId (AffiliateId),
   KEY PaymentDate (PaymentDate),
   KEY PaymentTypeId (PaymentTypeId)
 );
 
 CREATE TABLE AffiliatePaymentTypes (
-  PaymentTypeId int(11) NOT NULL auto_increment,
-  Name varchar(255) NOT NULL default '',
-  Description text NOT NULL,
-  IsPrimary tinyint(4) NOT NULL default '0',
-  Status tinyint(4) NOT NULL default '0',
-  Priority tinyint(4) NOT NULL default '0',
-  PRIMARY KEY  (PaymentTypeId),
+  PaymentTypeId int(11) NOT NULL AUTO_INCREMENT,
+  `Name` varchar(255) NOT NULL DEFAULT '',
+  Description text,
+  IsPrimary tinyint(4) NOT NULL DEFAULT '0',
+  `Status` tinyint(4) NOT NULL DEFAULT '0',
+  Priority tinyint(4) NOT NULL DEFAULT '0',
+  PRIMARY KEY (PaymentTypeId),
   KEY IsPrimary (IsPrimary),
-  KEY Status (Status),
+  KEY `Status` (`Status`),
   KEY Priority (Priority)
 );
 
@@ -643,47 +643,47 @@
 );
 
 CREATE TABLE Affiliates (
-  AffiliateId int(11) NOT NULL auto_increment,
-  PortalUserId int(10) unsigned NOT NULL default '0',
-  AffiliatePlanId int(10) unsigned NOT NULL default '0',
-  AccumulatedAmount decimal(10,2) NOT NULL default '0.00',
-  AmountToPay decimal(10,2) NOT NULL default '0.00',
-  LastPaymentDate INT(11) UNSIGNED NULL DEFAULT NULL,
-  LastOrderDate INT(11) UNSIGNED NULL DEFAULT NULL,
-  Status tinyint(4) NOT NULL default '2',
-  AffiliateCode varchar(30) NOT NULL default '',
-  ItemsSold int(10) unsigned NOT NULL default '0',
-  PaymentTypeId int(11) NOT NULL default '0',
-  SSN varchar(100) NOT NULL default '',
-  Comments text NOT NULL,
-  CreatedOn int(11) NOT NULL default '0',
-  PRIMARY KEY  (AffiliateId),
+  AffiliateId int(11) NOT NULL AUTO_INCREMENT,
+  PortalUserId int(10) unsigned NOT NULL DEFAULT '0',
+  AffiliatePlanId int(10) unsigned NOT NULL DEFAULT '0',
+  AccumulatedAmount decimal(10,2) NOT NULL DEFAULT '0.00',
+  AmountToPay decimal(10,2) NOT NULL DEFAULT '0.00',
+  LastPaymentDate int(11) unsigned DEFAULT NULL,
+  LastOrderDate int(11) unsigned DEFAULT NULL,
+  `Status` tinyint(4) NOT NULL DEFAULT '2',
+  AffiliateCode varchar(30) NOT NULL DEFAULT '',
+  ItemsSold int(10) unsigned NOT NULL DEFAULT '0',
+  PaymentTypeId int(11) NOT NULL DEFAULT '0',
+  SSN varchar(100) NOT NULL DEFAULT '',
+  Comments text,
+  CreatedOn int(11) DEFAULT NULL,
+  PRIMARY KEY (AffiliateId),
   UNIQUE KEY PortalUserId (PortalUserId),
   UNIQUE KEY AffiliateCode (AffiliateCode),
   KEY LastOrderDate (LastOrderDate),
   KEY AffiliatePlanId (AffiliatePlanId),
-  KEY Status (Status),
+  KEY `Status` (`Status`),
   KEY PaymentTypeId (PaymentTypeId),
   KEY CreatedOn (CreatedOn)
 );
 
 CREATE TABLE ProductOptionCombinations (
-  CombinationId int(11) NOT NULL auto_increment,
-  ProductId int(11) NOT NULL default '0',
-  Combination text NOT NULL,
-  CombinationCRC int(11) NOT NULL default '0',
-  PriceType tinyint(1) default '3',
-  Price float default NULL,
-  WeightType tinyint(1) default '3',
-  Weight float default NULL,
-  Availability tinyint(1) NOT NULL default '1',
-  Priority int(11) NOT NULL default '0',
-  QtyInStock int(11) NOT NULL default '0',
-  QtyReserved int(11) NOT NULL default '0',
-  QtyBackOrdered int(11) NOT NULL default '0',
-  QtyOnOrder int(11) NOT NULL default '0',
-  SKU varchar(255) NOT NULL default '',
-  PRIMARY KEY  (CombinationId),
+  CombinationId int(11) NOT NULL AUTO_INCREMENT,
+  ProductId int(11) NOT NULL DEFAULT '0',
+  Combination text,
+  CombinationCRC int(11) NOT NULL DEFAULT '0',
+  PriceType tinyint(1) DEFAULT '3',
+  Price float DEFAULT NULL,
+  WeightType tinyint(1) DEFAULT '3',
+  Weight float DEFAULT NULL,
+  Availability tinyint(1) NOT NULL DEFAULT '1',
+  Priority int(11) NOT NULL DEFAULT '0',
+  QtyInStock int(11) NOT NULL DEFAULT '0',
+  QtyReserved int(11) NOT NULL DEFAULT '0',
+  QtyBackOrdered int(11) NOT NULL DEFAULT '0',
+  QtyOnOrder int(11) NOT NULL DEFAULT '0',
+  SKU varchar(255) NOT NULL DEFAULT '',
+  PRIMARY KEY (CombinationId),
   KEY CombinationCRC (CombinationCRC),
   KEY ProductId (ProductId),
   KEY Availability (Availability)
