| @@ 453-457 (lines=5) @@ | ||
| 450 | $accounts = $this->accounts($to == 'sql' ? 'ldap' : 'sql', $passwords2sql ? 'accounts' : 'both'); |
|
| 451 | ||
| 452 | // clean up SQL before migration |
|
| 453 | if ($to == 'sql' && $this->truncate_egw_accounts) |
|
| 454 | { |
|
| 455 | $GLOBALS['egw']->db->query('TRUNCATE TABLE egw_accounts', __LINE__, __FILE__); |
|
| 456 | $GLOBALS['egw']->db->query('DELETE FROM egw_addressbook WHERE account_id IS NOT NULL', __LINE__, __FILE__); |
|
| 457 | } |
|
| 458 | // instanciate accounts obj for new store |
|
| 459 | $accounts_obj = $this->accounts_obj($to); |
|
| 460 | ||
| @@ 2179-2186 (lines=8) @@ | ||
| 2176 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET range_end = (SELECT MIN(cal_end) FROM egw_cal_dates WHERE egw_cal_dates.cal_id=egw_cal.cal_id)', __LINE__, __FILE__); |
|
| 2177 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal_repeats SET recur_enddate=null WHERE recur_enddate=0', __LINE__, __FILE__); |
|
| 2178 | // MySQL has different syntax for updates using values from other tables ... |
|
| 2179 | if ($GLOBALS['egw_setup']->db->Type == 'mysql') |
|
| 2180 | { |
|
| 2181 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal,egw_cal_repeats SET egw_cal.range_end=egw_cal_repeats.recur_enddate WHERE egw_cal.cal_id=egw_cal_repeats.cal_id', __LINE__, __FILE__); |
|
| 2182 | } |
|
| 2183 | else // PostgreSQL, MsSQL, ... |
|
| 2184 | { |
|
| 2185 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET range_end=recur_enddate FROM egw_cal_repeats WHERE egw_cal.cal_id=egw_cal_repeats.cal_id', __LINE__, __FILE__); |
|
| 2186 | } |
|
| 2187 | $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal_repeats',array( |
|
| 2188 | 'fd' => array( |
|
| 2189 | 'cal_id' => array('type' => 'int','precision' => '4','nullable' => False), |
|
| @@ 179-186 (lines=8) @@ | ||
| 176 | } |
|
| 177 | while($n == $junk_size); |
|
| 178 | ||
| 179 | if ($total) |
|
| 180 | { |
|
| 181 | echo "Api Update 16.1.005: deleted $total doublicate rows from egw_sqlfs_props table.\n"; |
|
| 182 | ||
| 183 | // drop autoincrement (prop_id) and recreate it, in case it got to close to 32 bit limit |
|
| 184 | $GLOBALS['egw_setup']->db->query('ALTER TABLE egw_sqlfs_props DROP prop_id', __LINE__, __FILE__); |
|
| 185 | $GLOBALS['egw_setup']->db->query('ALTER TABLE egw_sqlfs_props ADD prop_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY', __LINE__, __FILE__); |
|
| 186 | } |
|
| 187 | } |
|
| 188 | ||
| 189 | // drop non-unique index and re-create it as unique |
|