|
Lines 2-7
$DBversion = 'XXX'; # will be replaced by the RM
Link Here
|
| 2 |
if( CheckVersion( $DBversion ) ) { |
2 |
if( CheckVersion( $DBversion ) ) { |
| 3 |
if( !index_exists( 'library_groups', 'library_groups_uniq_2' ) ) { |
3 |
if( !index_exists( 'library_groups', 'library_groups_uniq_2' ) ) { |
| 4 |
$dbh->do(q| |
4 |
$dbh->do(q| |
|
|
5 |
DELETE FROM library_groups |
| 6 |
WHERE id NOT IN ( |
| 7 |
SELECT MIN(id) |
| 8 |
FROM library_groups |
| 9 |
WHERE parent_id IS NOT NULL |
| 10 |
GROUP BY parent_id, branchcode |
| 11 |
) |
| 12 |
AND parent_id IS NOT NULL; |
| 13 |
|); |
| 14 |
$dbh->do(q| |
| 5 |
ALTER TABLE library_groups |
15 |
ALTER TABLE library_groups |
| 6 |
ADD UNIQUE KEY library_groups_uniq_2 (parent_id, branchcode) |
16 |
ADD UNIQUE KEY library_groups_uniq_2 (parent_id, branchcode) |
| 7 |
|); |
17 |
|); |
| 8 |
- |
|
|