{"id":699,"date":"2011-08-21T16:50:34","date_gmt":"2011-08-21T06:50:34","guid":{"rendered":"http:\/\/howden.net.au\/thowden\/?p=699"},"modified":"2011-08-21T16:50:34","modified_gmt":"2011-08-21T06:50:34","slug":"converting-oscommerce-to-oscmax-mysql-database-structure","status":"publish","type":"post","link":"https:\/\/howden.net.au\/thowden\/2011\/08\/converting-oscommerce-to-oscmax-mysql-database-structure\/","title":{"rendered":"Converting osCommerce to osCmax mySQL database structure"},"content":{"rendered":"<p>I am in the process of converting some older osCommerce based web sites to osCmax and the underlying database structure is different. The following is the step by step that I have worked through for one site. <\/p>\n<p>Updated: 24th Aug 2011: Embedded updates for tables in the following as I worked through the conversion.<\/p>\n<p>In preparing for this I have exported the structure only from the old site and from the current osCmax svn version that I have running on my system.  I use <a href=\"http:\/\/www.scootersoftware.com\/\" title=\"Beyond Compare from Scooter Software\" target=\"_blank\">Beyond Compare from Scooter Software<\/a> for my file \/ folder comparison work and I have opened up the two structure files for comparison.<\/p>\n<p>Note: the old osCommerce is based on an early 2.1 version updated and modified for unique requirements over the 10 years or so it has been in operation. It&#8217;s been a reluctance to even start contemplating this change that has led it to be so long.<\/p>\n<p>Table: address_book:<\/p>\n<p>The first two fields are in reverse order and the address_book_id is now a unique auto_increment field.<br \/>\nThe address_book_id field in the old db will need to be dumped and the auto_increment value accepted.<br \/>\nentry_company_tax_id is a new field<br \/>\nentry_telephone is no longer used &#8211; checking my data they are all NULL so not required<\/p>\n<p>Tables: address_book and address_book_new both exist in the old osCommerce database but not in osCmax. Both tables are populated so I&#8217;ll need to compare the data in the two.<br \/>\nUpdate: address_book_new is from an attempt to convert to creloaded some years ago, it is not an osCommerce table and can be ignored.<\/p>\n<p>Table: anti_robotreg does not exist in osCmax and is empty in the old system. Dump this.<\/p>\n<p>Tables: admin, etc. through to authors_info do not exist in the old system. These can be ignored.<\/p>\n<p>Table: banners and banners_history no change.<br \/>\nUpdate: There is data in the new system that can be cleared.<\/p>\n<p>Table: cache does not exist in the old. <\/p>\n<p>Table: categories. Need to add new fields to old to align with new.<br \/>\nafter sort_order<br \/>\n`categories_featured_until` date default NULL,<br \/>\n`categories_featured` tinyint(1) default &#8216;0&#8217;,<br \/>\nafter last_modified add<br \/>\n`categories_hide_from_groups` varchar(255) NOT NULL default &#8216;@&#8217;,<\/p>\n<p>In old remove the fields<br \/>\n`categories_customizable` tinyint(1) DEFAULT &#8216;1&#8217;,<br \/>\n`tpl_file` varchar(30) DEFAULT NULL,<br \/>\nthese are not in the new<\/p>\n<p>Table: categories_description<br \/>\nAdd two new fields to old to align with new<br \/>\n  `categories_description` text,<br \/>\n  `categories_heading_title` varchar(64) default NULL,<\/p>\n<p>Update: the categories column order changed to match and confirmed that data in new can be cleared.<\/p>\n<p>Tables: configuration, configuration_group, counter, &amp; counter_history are the same barring some minor formatting and default settings that should not impact.<\/p>\n<p>Update: configuration table has a huge difference in the number of entries. The data content needs to be compared and merged rather than overwritten.<\/p>\n<p>Table: countries<br \/>\nAdd a new field to old to align with new<br \/>\n  `active` tinyint(3) unsigned default &#8216;1&#8217;,<\/p>\n<p>Table: currencies, no change.<\/p>\n<p>Table: customers<br \/>\nAdd new field after customers_id<br \/>\n  `purchased_without_account` tinyint(1) unsigned NOT NULL default &#8216;0&#8217;,<\/p>\n<p>Change   `customers_default_address_id` int(5) to   `customers_default_address_id` int(11)<br \/>\nAdd new fields after customers_newsletter<br \/>\n  `customers_newsletter_type` varchar(32) NOT NULL default &#8216;html&#8217;,<br \/>\n  `guest_account` tinyint(1) NOT NULL default &#8216;0&#8217;,<br \/>\n  `customers_login` varchar(96) default NULL,<br \/>\n  `customers_group_name` varchar(27) NOT NULL default &#8216;Retail&#8217;,<br \/>\n  `customers_group_id` int(11) NOT NULL default &#8216;0&#8217;,<br \/>\n  `customers_group_ra` enum(&#8216;0&#8242;,&#8217;1&#8217;) NOT NULL default &#8216;0&#8217;,<br \/>\n  `customers_payment_allowed` varchar(255) NOT NULL,<br \/>\n  `customers_shipment_allowed` varchar(255) NOT NULL,<br \/>\n  `customers_paypal_payerid` varchar(20) default NULL,<br \/>\n  `customers_paypal_ec` tinyint(1) unsigned NOT NULL default &#8216;0&#8217;,<\/p>\n<p>Table: customers_basket no change.<\/p>\n<p>Table: customers_basket_attributes<br \/>\nadd new field after products_options_value_id<br \/>\n  `products_options_value_text` varchar(32) default NULL,<\/p>\n<p>Tables: customers_groups is new  customers_info no change.<\/p>\n<p>Table customers_new is in old but not new. Need to validate data in this and customers prior to export.<\/p>\n<p>Tables: customers_notes and wishlist related, extra fields, and feeds are only in new.<\/p>\n<p>Table: geozones no change, new tables for google etc only in new.<\/p>\n<p>Table: languages<br \/>\nAdd new field after sort_order<br \/>\n  `meta_keywords` varchar(255) default NULL,<\/p>\n<p>Table: manufacturers<br \/>\nAdd new fields after manufacturers_image<br \/>\n  `manufacturers_featured_until` date default NULL,<br \/>\n  `manufacturers_featured` tinyint(1) default &#8216;0&#8217;,<br \/>\n  `manufacturer_featured_until` date default NULL,<br \/>\n  `manufacturer_featured` tinyint(1) default &#8216;0&#8217;,<\/p>\n<p>Table: manufacturers_info<br \/>\nAdd new field after manufacturers_url<br \/>\n  `manufacturers_description` text,<\/p>\n<p>Table: orders<br \/>\nAdd new field after customers_address_format_id<br \/>\n  `customers_dummy_account` tinyint(3) unsigned NOT NULL,<\/p>\n<p>Remove   `delivery_telephone` varchar(32) DEFAULT NULL, from old table as not in new data is all null.<br \/>\nRemove   `billing_telephone` varchar(32) DEFAULT NULL,<\/p>\n<p>Old field   `cc_ccv` varchar(3) DEFAULT NULL COMMENT &#8216;CCV 3 Digits&#8217;,  is not in new but seems like a necessary field. Need to include for the moment and dump later if not required. Some values are present.<\/p>\n<p>Old field   `payment_method` varchar(32) NOT NULL DEFAULT &#8221;, is changed to<br \/>\n  `payment_method` varchar(255) NOT NULL DEFAULT &#8221;<br \/>\nNot sure how this interacts with payment processes. Will retain field as payment_method_old leaving the new field as payment_method. Refer to table orders_pay_methods  which is also retained and linked to this field but is not in the new structure.<\/p>\n<p>Three fields in old can be dropped as they are all empty.<br \/>\n  `account_name` varchar(32) NOT NULL DEFAULT &#8221;,<br \/>\n  `account_number` varchar(20) DEFAULT NULL,<br \/>\n  `po_number` varchar(12) DEFAULT NULL,<\/p>\n<p>New fields to add after currency_value<br \/>\n  `paypal_ipn_id` int(11) NOT NULL default &#8216;0&#8217;,<br \/>\n  `fedex_tracking` varchar(20) NOT NULL,<br \/>\n  `purchased_without_account` tinyint(1) unsigned NOT NULL default &#8216;0&#8217;,<br \/>\n  `shipping_tax` decimal(7,4) NOT NULL default &#8216;0.0000&#8217;,<br \/>\n  `shipping_module` varchar(255) default NULL,<\/p>\n<p>Table: orders_pay_methods not in new. Retain in new until determining how this works.<\/p>\n<p>Table: orders_premade_comments not in old.<\/p>\n<p>Table: orders_products<br \/>\nAdd new field after   `products_model`<br \/>\n  `products_code` varchar(40) NOT NULL,<\/p>\n<p>Add new field after  `products_quantity`<br \/>\n  `products_stock_attributes` varchar(255) default NULL,<\/p>\n<p>Table: orders_products_attributes<br \/>\nAdd new field after  `products_options_values`<br \/>\n  `code_suffix` varchar(16) NOT NULL,<\/p>\n<p>Add new fields after   `price_prefix`<br \/>\n  `weight_prefix` char(1) NOT NULL,<br \/>\n  `options_values_weight` decimal(6,3) NOT NULL default &#8216;0.000&#8217;,<\/p>\n<p>Table: orders_products_download no change.<\/p>\n<p>Table: orders_ship_methods not in new. appears to relate to new field in orders regarding shipping_module. Retain and test post change.<\/p>\n<p>Table: orders_status<br \/>\nAdd new fields after   `orders_status_name`<br \/>\n  `public_flag` int(11) default &#8216;1&#8217;,<br \/>\n  `downloads_flag` int(11) default &#8216;0&#8217;,<\/p>\n<p>Tables: orders_status_history and orders_total no change<\/p>\n<p>Table: packaging is new<\/p>\n<p>Table: paypalipn_txn appears the same \/ similar to paypal_ipn. Will need to look at data changes.<\/p>\n<p>There are many fields in old and not in new and vice-versa. Trying to match the data will be time-consuming.  Need to assess if this needs to be done or not.  Retain old table as itself for the time being.<\/p>\n<p>Table: pm_configuration is new.<\/p>\n<p>Table: products is also complex in the changes. Need to review.<\/p>\n<p>Table: products_attributes<br \/>\nAdd new fields after   `options_values_id`<br \/>\n  `code_suffix` varchar(16) NOT NULL,<br \/>\n  `suffix_sort_order` int(4) NOT NULL default &#8216;0&#8217;,<br \/>\nand Add new fields after   `price_prefix`<br \/>\n  `weight_prefix` char(1) NOT NULL,<br \/>\n  `options_values_weight` decimal(6,3) NOT NULL default &#8216;0.000&#8217;,<br \/>\n  `products_options_sort_order` int(10) unsigned NOT NULL default &#8216;0&#8217;,<\/p>\n<p>Table: products_attributes_download no change<\/p>\n<p>Table: products_description<br \/>\nAdd new field after   `products_name`<br \/>\n  `products_short` text,<\/p>\n<p>Add new fields after   `products_description` text,<br \/>\n  `tab1` text,<br \/>\n  `tab2` text,<br \/>\n  `tab3` text,<br \/>\n  `tab4` text,<br \/>\n  `tab5` text,<br \/>\n  `tab6` text,<\/p>\n<p>Table: products_groups is new<\/p>\n<p>Table: products_notifications no change<\/p>\n<p>Table: products_options<\/p>\n<p>Add new fields after  `products_options_name`<br \/>\n  `products_options_track_stock` tinyint(4) NOT NULL default &#8216;0&#8217;,<br \/>\n  `products_options_type` int(5) NOT NULL default &#8216;0&#8217;,<br \/>\n  `products_options_length` smallint(2) NOT NULL default &#8217;32&#8217;,<br \/>\n  `products_options_comment` varchar(32) default NULL,<br \/>\n  `products_options_sort_order` int(10) unsigned NOT NULL default &#8216;0&#8217;,<\/p>\n<p>Table: products_options_products is not in new.<\/p>\n<p>Table: products_options_description is new<\/p>\n<p>Tables: products_options_values, products_options_values_to_products_options are the same<\/p>\n<p>Tables: products_price_break &amp; products_stock are new<\/p>\n<p>Table: products_to_categories is the same<\/p>\n<p>Tables: products_to_discount_categories, products_xsell, &amp; quick_links are new<\/p>\n<p>Table: reviews<br \/>\nAdd new field after   `reviews_rating`<br \/>\n  `approved` tinyint(3) unsigned default &#8216;0&#8217;,<\/p>\n<p>Tables: scart, all search*, shipping_manifest and slideshow are new.<\/p>\n<p>Table: sessions no change.<\/p>\n<p>Table: specials<br \/>\nAdd new field after   `status`<br \/>\n  `customers_group_id` int(11) NOT NULL default &#8216;0&#8217;,<\/p>\n<p>Table: suppliers is custom to the old system. links in products and currencies need to be managed. relates to proposed module to manage outbound purchase orders and product costing.<\/p>\n<p>Table: specials_retail_prices is new<\/p>\n<p>Tables: tax_class, tax_rates no change<\/p>\n<p>Table: theme_configuration is new<\/p>\n<p>Table: tep_meta_tags is not in new<\/p>\n<p>Tables: topics* and usu_cache are new<\/p>\n<p>Table: whos_online<br \/>\nAdd new fields after   `ip_address`<br \/>\n  `hostname` varchar(255) NOT NULL,<br \/>\n  `country_code` varchar(2) NOT NULL,<br \/>\n  `country_name` varchar(64) NOT NULL,<br \/>\n  `region_name` varchar(64) NOT NULL,<br \/>\n  `city` varchar(64) NOT NULL,<br \/>\n  `latitude` float NOT NULL,<br \/>\n  `longitude` float NOT NULL,<\/p>\n<p>Add new fields after   `last_page_url` text NOT NULL,<br \/>\n  `http_referer` varchar(255) NOT NULL,<br \/>\n  `user_agent` varchar(255) NOT NULL,<\/p>\n<p>Tables: zones* are no change<\/p>\n<p>Next is to build a script to make the structure changes and then extend it to convert the data. I need this in order to do some trial runs before a live cut-over. It will be useful for the creLoaded stores that I need to do as well.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I am in the process of converting some older osCommerce based web sites to osCmax and the underlying database structure is different. The following is the step by step that I have worked through for one site. Updated: 24th Aug 2011: Embedded updates for tables in the following as I worked through the conversion. In [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,12],"tags":[],"class_list":["post-699","post","type-post","status-publish","format-standard","hentry","category-mysql","category-oscommerce-oscmax"],"_links":{"self":[{"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/posts\/699","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/comments?post=699"}],"version-history":[{"count":0,"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/posts\/699\/revisions"}],"wp:attachment":[{"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/media?parent=699"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/categories?post=699"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/tags?post=699"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}