Upgrading from 0.6.5 to 0.6.6

Here is what to do (Unix style, log in to server first):

  1. Backup your 0.6.5 directory!!!

    cd /one/folder/above/moregroupware

    cp -R moregroupware moregroupware.bak

  2. Backup your database!!!

    mysqldump --add-drop-table -a -u [user] -p [dbname] > ~/mgw065.sql

  3. Get the new release from sourceforge.net.

  4. Unpack the files from the archive, remove the old stuff before. You can safely ignore errors on the template_c and cache (and store) folders.

    cd /one/folder/above/moregroupware

    rm -r moregroupware/*

    tar xzf moregroupware_0_6_6.tar.gz

  5. Drop and recreate the database (or delete all tables in it).

    mysql -u [user] -p -e "DROP DATABASE [dbname]"

    mysql -u [user] -p -e "CREATE DATABASE [dbname]"

  6. Go through the usual setup process now. We will restore your data later.

  7. Again drop and recreate the database (or delete all tables in it).

    mysql -u [user] -p -e "DROP DATABASE [dbname]"

    mysql -u [user] -p -e "CREATE DATABASE [dbname]"

  8. Now let's restore your old data in the database. Use the dump created in step 2 to restore the data.

    mysql -u [user] -p [dbname] < ~/mgw065.sql

  9. You need to adjust the database now. The SQL that is shown below needs to be inserted into the database.

    mysql -u [user] -p [dbname] < mgw065-mgw066.sql

    Here is the SQL mentioned above:

              ALTER TABLE mgw_calendar CHANGE COLUMN subject subject TEXT NOT NULL; # was varchar(100) NOT NULL default ''
              ALTER TABLE mgw_calendar_tmp CHANGE COLUMN subject subject TEXT NOT NULL; # was varchar(100) NOT NULL default ''
              
              INSERT INTO mgw_configtags VALUES ('overview_news','news','numer of news to show in overview',0,0,'int',1,'2002-01-01');
              INSERT INTO mgw_configtags VALUES ('def_module','*','default module to show',0,0,'str',1,'2002-01-01');
              INSERT INTO mgw_configtags VALUES ('overview_notes','notes','numer of notes to show in overview',0,0,'int',1,'2002-01-01');
              INSERT INTO mgw_configtags VALUES ('notes_orderby','notes','default order of notes',0,0,'str',1,'2002-01-01');
              INSERT INTO mgw_configtags VALUES ('notes_order_dir','notes','order asc or desc',0,0,'str',1,'2002-01-01');
              
              ALTER TABLE mgw_config DROP COLUMN value_blob; # was blob NOT NULL
              INSERT INTO mgw_config VALUES (0,'def_module',1,'overview',0,'',1,'2002-01-01');
              INSERT INTO mgw_config VALUES (0,'overview_news',1,'5',0,'',1,'2002-01-01');
              INSERT INTO mgw_config VALUES (0,'overview_notes',1,'5',0,'',1,'2002-01-01');
              UPDATE mgw_config SET value_int=1 WHERE value_str='checked';
              
              ALTER TABLE mgw_contacts_history CHANGE COLUMN contact_date contact_date timestamp(14) NOT NULL; # was datetime NOT NULL default '0000-00-00 00:00:00'
              
              ALTER TABLE mgw_headline_channels ADD COLUMN private INTEGER NOT NULL default '0';
              ALTER TABLE mgw_headline_rss ADD COLUMN private INTEGER NOT NULL default '0';
              ALTER TABLE mgw_headline_rss ADD COLUMN lu_date timestamp(14) NOT NULL;
              ALTER TABLE mgw_headline_rss ADD COLUMN lu_user INTEGER NOT NULL default '0';
              
              ALTER TABLE mgw_jobhours_time CHANGE COLUMN time time decimal(8,2) NOT NULL default '0.00'; # was decimal(4,2) NOT NULL default '0.00'
              
              ALTER TABLE mgw_notes_categories DROP INDEX name_key; # was UNIQUE (name)
              ALTER TABLE mgw_notes_categories ADD INDEX name (name);
              
              ALTER TABLE mgw_projects CHANGE COLUMN startdate startdate date default NULL; # was date NOT NULL default '0000-00-00'
              ALTER TABLE mgw_projects CHANGE COLUMN enddate enddate date default NULL; # was date NOT NULL default '0000-00-00'
              
              ALTER TABLE mgw_users ADD COLUMN lastin timestamp(14) NOT NULL;
              
              CREATE TABLE mgw_files (
              id INTEGER NOT NULL default '0',
              type CHAR(1) NOT NULL default 'f',
              resides_in INTEGER default NULL,
              owner INTEGER NOT NULL default '0',
              name varchar(50) default NULL,
              mime_type varchar(20) default NULL,
              owner_rights CHAR(1) NOT NULL default '',
              all_rights CHAR(1) NOT NULL default '',
              created timestamp(14) NOT NULL,
              modified timestamp(14) NOT NULL,
              modified_by INTEGER default NULL,
              links_to INTEGER default NULL,
              PRIMARY KEY  (id),
              UNIQUE KEY resides_in (resides_in,name)
              );
              
              CREATE TABLE mgw_files_grouprights (
              id INTEGER NOT NULL default '0',
              for_file INTEGER default NULL,
              for_group INTEGER default NULL,
              rights CHAR(1) NOT NULL default '',
              PRIMARY KEY  (id),
              UNIQUE KEY for_file (for_file,for_group)
              );
              
              CREATE TABLE mgw_outboard (
              id_username INTEGER NOT NULL default '0',
              tsout INTEGER NOT NULL default '0',
              tsin INTEGER NOT NULL default '0',
              location TEXT,
              notes TEXT,
              autoin CHAR(1) NOT NULL default '',
              statusid CHAR(2) NOT NULL default '',
              lu_user INTEGER NOT NULL default '0',
              lu_update INTEGER NOT NULL default '0',
              PRIMARY KEY  (id_username)
              );
            
    [Important]Important

    If you have been using the webmail2 module, make sure you restore the contents of the modules/webmail2/store/ directory. Now read the webmail2 update manual in MGW_0-65_to_0-66_Webmail_Update_manual.pdf in modules/webmail2/docu/! You need to drop the webmail2 tables and restore them from your SQL backup before this will work!

  10. Now log in and verify everything works as expected (or at least as good as before...).

  11. If all is up and running, you can safely delete the backup files and the SQL dump created in steps 1 and 2.

If you run into trouble, you can revert back to the old release by removing the new moregroupware directory, moving back the backup dir and just piping the backup SQL into the database:

rm -ri moregroupware

mv -i moregroupware.bak moregroupware

mysql -u [user] -p -e "DROP DATABASE [dbname]"

mysql -u [user] -p -e "CREATE DATABASE [dbname]"

mysql -u [user] -p [dbname] < mgw065.sql