how to do db upgrades manually

We use SVN for all of our revisions.



When a new upgrade comes out, we checkout a new branch, run it on a development site, do the upgrade, commit the upgrade, compare the previous versions and current versions, convert over our changes, commit, then export the branch to the live site.



The only problem occurs when there are changes to the database. Since that doesn’t show up in the files, I need to manually do that.



When doing an upgrade, it lists the files that are going to be changed, but nothing about the db.



I really need to see what DB changes are going to be made well before I click upgrade. Depending on what they are, I might upgrade and use the dev on the live db, or switch it to a dev db.



How can this be done?

To get the most accurate list of changes to the database, I download the full version of the newest cs cart. In the install directory there is a schema file for the database structure. I compare that to the same file for my version of cs cart from which I make an update sql file for the changes. I do the same with the data files for each version of the cart to make sure I have all of the database data that is new to the newest version.

I more or less go about it the same as Adodric & find a good database compare & synch tool such as Navicat a very useful addition to my toolbox, actually “priceless”.



[url]Error | Navicat

I suggest Beyond Compare 3, i use it compare all php files and .sql files, then upgrade manual.

[quote name=‘Wayne’]I suggest Beyond Compare 3, i use it compare all php files and .sql files, then upgrade manual.[/quote]



I have both and I didn’t know you could do that :smiley:

Arg, I was hoping someone would have a solution to find whatever sql table mod file the upgrade actually uses. Is there a way for me to download the specific upgrade files without running the upgrade itself?





I use Ultracompare 7 which is great for comparing both directory structures and files with 2 and 3 way comparisons. That way I can compare my modded version, in the middle; with the stock current version I’m running, on the left; and the upgrade, on the right. That way I can see what changes are only mine, vs changes that are to the core.



For MySQL development I’ve been using MySQL Workbench which is really wonderful for db design.



I haven’t heard of Navicat, but I looked at the site and think I’ll check it out. It looks a little bit like MS SQL Server Management Studio.



Anyone familiar with MySQL Workbench and Navicat (and Management Studio) that could give a comparison?

Well, for anyone who wants to know…



When you click Install, it goes to a check page and closes your store. At that point you can simply go to the “var/upgrade” directory and find uc.tgz. Inside that file is a uc.sql which appears to have all the sql updates in it. Simply save that and use it on the live db when needed.



Here’s an ex of what was in the 2.0.15 uc.sql file:



```php

INSERT INTO cscart_language_values (lang_code, name, value) VALUES (‘EN’, ‘sharedsec’, ‘SharedSec’) ON DUPLICATE KEY UPDATE lang_code = lang_code;

INSERT INTO cscart_language_values (lang_code, name, value) VALUES (‘EN’, ‘text_sage_payment_notice’, ‘’) ON DUPLICATE KEY UPDATE lang_code = lang_code;

INSERT INTO cscart_language_values (lang_code, name, value) VALUES (‘EN’, ‘if_printed_on_your_card’, ‘(If printed on your card)’) ON DUPLICATE KEY UPDATE lang_code = lang_code;

INSERT INTO cscart_language_values (lang_code, name, value) VALUES (‘EN’, ‘price_dec_sign_delimiter’, ‘Price decimal separator’) ON DUPLICATE KEY UPDATE lang_code = lang_code;

INSERT INTO cscart_language_values (lang_code, name, value) VALUES (‘EN’, ‘text_price_dec_sign_delimiter’, ‘Decimal separator for product prices.’) ON DUPLICATE KEY UPDATE lang_code = lang_code;



INSERT INTO cscart_settings (option_id, option_name, section_id, subsection_id, option_type, value, position, is_global) VALUES (‘9192’, ‘priority_girth’, ‘Shippings’, ‘usps’, ‘I’, ‘’, ‘161’, ‘Y’) ON DUPLICATE KEY UPDATE option_id = option_id;

INSERT INTO cscart_settings (option_id, option_name, section_id, subsection_id, option_type, value, position, is_global) VALUES (‘110’, ‘first_class_mail_type’, ‘Shippings’, ‘usps’, ‘S’, ‘’, ‘81’, ‘N’) ON DUPLICATE KEY UPDATE option_id = option_id;



INSERT INTO cscart_settings_descriptions (object_id, description, object_type, lang_code, object_string_id, tooltip) VALUES (‘9192’, ‘Priority Mail (Size:Large, Container:NonRectangular) Girth (inches)’, ‘O’, ‘EN’, ‘’, ‘’) ON DUPLICATE KEY UPDATE object_id = object_id;

INSERT INTO cscart_settings_descriptions (object_id, description, object_type, lang_code, object_string_id, tooltip) VALUES (‘110’, ‘First Class Mail Type’, ‘O’, ‘EN’, ‘’, ‘’) ON DUPLICATE KEY UPDATE object_id = object_id;

INSERT INTO cscart_settings_descriptions (object_id, description, object_type, lang_code, object_string_id, tooltip) VALUES (‘10310’, ‘Letter’, ‘V’, ‘EN’, ‘’, ‘’) ON DUPLICATE KEY UPDATE object_id = object_id;

INSERT INTO cscart_settings_descriptions (object_id, description, object_type, lang_code, object_string_id, tooltip) VALUES (‘10320’, ‘Flat’, ‘V’, ‘EN’, ‘’, ‘’) ON DUPLICATE KEY UPDATE object_id = object_id;

INSERT INTO cscart_settings_descriptions (object_id, description, object_type, lang_code, object_string_id, tooltip) VALUES (‘10330’, ‘Parcel’, ‘V’, ‘EN’, ‘’, ‘’) ON DUPLICATE KEY UPDATE object_id = object_id;



INSERT INTO cscart_settings_variants (variant_id, option_id, variant_name, position) VALUES (‘10310’, ‘110’, ‘LETTER’, ‘10’) ON DUPLICATE KEY UPDATE variant_id = variant_id;

INSERT INTO cscart_settings_variants (variant_id, option_id, variant_name, position) VALUES (‘10320’, ‘110’, ‘FLAT’, ‘20’) ON DUPLICATE KEY UPDATE variant_id = variant_id;

INSERT INTO cscart_settings_variants (variant_id, option_id, variant_name, position) VALUES (‘10330’, ‘110’, ‘PARCEL’, ‘30’) ON DUPLICATE KEY UPDATE variant_id = variant_id;



INSERT INTO cscart_addon_descriptions (addon, object_id, object_type, description, tooltip, lang_code) VALUES (‘sms_notifications’, ‘clickatel_concat_3’, ‘V’, ‘3 sms’, ‘’, ‘EN’) ON DUPLICATE KEY UPDATE addon = addon;

INSERT INTO cscart_addon_descriptions (addon, object_id, object_type, description, tooltip, lang_code) VALUES (‘sms_notifications’, ‘clickatel_concat_1’, ‘V’, ‘Do not split’, ‘’, ‘EN’) ON DUPLICATE KEY UPDATE addon = addon;

INSERT INTO cscart_addon_descriptions (addon, object_id, object_type, description, tooltip, lang_code) VALUES (‘sms_notifications’, ‘clickatel_concat_2’, ‘V’, ‘2 sms’, ‘’, ‘EN’) ON DUPLICATE KEY UPDATE addon = addon;

INSERT INTO cscart_addon_descriptions (addon, object_id, object_type, description, tooltip, lang_code) VALUES (‘sms_notifications’, ‘clickatel_concat’, ‘O’, ‘Split long sms into several parts’, ‘’, ‘EN’) ON DUPLICATE KEY UPDATE addon = addon;

INSERT INTO cscart_addon_descriptions (addon, object_id, object_type, description, tooltip, lang_code) VALUES (‘sms_notifications’, ‘clickatel_unicode’, ‘O’, ‘Use Unicode’, ‘’, ‘EN’) ON DUPLICATE KEY UPDATE addon = addon;



DELETE FROM cscart_language_values WHERE name=‘text_verus_notice’;



UPDATE cscart_language_values SET value=‘’ WHERE name=‘text_chronopay_form_notice’;

UPDATE cscart_settings_descriptions SET description=‘Machinable (First-Class Mail or Parcel Post)’, tooltip=‘’ WHERE object_id=‘115’;

UPDATE cscart_settings_descriptions SET description=‘Priority Mail (Size:Large) Width (inches)’, tooltip=‘’ WHERE object_id=‘9188’;

UPDATE cscart_settings_descriptions SET description=‘Priority Mail (Size:Large) Height (inches)’, tooltip=‘’ WHERE object_id=‘9189’;

UPDATE cscart_settings_descriptions SET description=‘Priority Mail (Size:Large) Length (inches)’, tooltip=‘’ WHERE object_id=‘9190’;

UPDATE cscart_payment_processors SET processor=‘Sage Payment Solutions’, processor_script=‘sage_payment.php’, processor_template=‘cc.tpl’, admin_template=‘sage_payment.tpl’, callback=‘Y’, type=‘P’ WHERE processor_id=‘30’;



```





If you don’t use sage pay, it doesn’t appear that any of the db updates will affect the running of the cart in any manner. So I’m just going to run the update on a dev copy of the files using the live db.