Lines 1-36
Link Here
|
1 |
use Modern::Perl; |
1 |
use Modern::Perl; |
2 |
|
2 |
|
3 |
return { |
3 |
return { |
4 |
bug_number => "35380", |
4 |
bug_number => "35380", |
5 |
description => "Add new unique name to record sources, add default record sources, add is_system column to default record sources.", |
5 |
description => |
|
|
6 |
"Add new unique name to record sources, add default record sources, add is_system column to default record sources.", |
6 |
up => sub { |
7 |
up => sub { |
7 |
my ($args) = @_; |
8 |
my ($args) = @_; |
8 |
my ($dbh, $out) = @$args{qw(dbh out)}; |
9 |
my ( $dbh, $out ) = @$args{qw(dbh out)}; |
9 |
|
10 |
|
10 |
# change name to be unique |
11 |
# change name to be unique |
11 |
if ( !unique_key_exists('record_sources', 'name') ) { |
12 |
if ( !unique_key_exists( 'record_sources', 'name' ) ) { |
12 |
$dbh->do(q{ |
13 |
$dbh->do( |
|
|
14 |
q{ |
13 |
ALTER TABLE record_sources |
15 |
ALTER TABLE record_sources |
14 |
ADD UNIQUE KEY name (`name`) |
16 |
ADD UNIQUE KEY name (`name`) |
15 |
}); |
17 |
} |
|
|
18 |
); |
16 |
say $out "Added unique key 'name' "; |
19 |
say $out "Added unique key 'name' "; |
17 |
} |
20 |
} |
18 |
|
21 |
|
19 |
# add column is system |
22 |
# add column is system |
20 |
unless ( column_exists('record_sources', 'is_system') ) { |
23 |
unless ( column_exists( 'record_sources', 'is_system' ) ) { |
21 |
$dbh->do(q{ ALTER TABLE record_sources ADD COLUMN `is_system` TINYINT(1) NOT NULL DEFAULT 0 AFTER can_be_edited }); |
24 |
$dbh->do( |
22 |
say $out "Added column 'record_sources.is_system'"; |
25 |
q{ ALTER TABLE record_sources ADD COLUMN `is_system` TINYINT(1) NOT NULL DEFAULT 0 AFTER can_be_edited } |
|
|
26 |
); |
27 |
say $out "Added column 'record_sources.is_system'"; |
23 |
} |
28 |
} |
24 |
|
29 |
|
25 |
$dbh->do(q{ |
30 |
$dbh->do( |
|
|
31 |
q{ |
26 |
INSERT IGNORE INTO record_sources ( name, can_be_edited, is_system ) |
32 |
INSERT IGNORE INTO record_sources ( name, can_be_edited, is_system ) |
27 |
VALUES |
33 |
VALUES |
28 |
('batchmod', 0, 1 ), |
34 |
('batchmod', 1, 1 ), |
29 |
('intranet', 0, 1 ), |
35 |
('intranet', 1, 1 ), |
30 |
('batchimport', 0, 1 ), |
36 |
('batchimport', 1, 1 ), |
31 |
('z3950', 0, 1 ), |
37 |
('z3950', 1, 1 ), |
32 |
('bulkmarcimport', 0, 1 ), |
38 |
('bulkmarcimport', 1, 1 ), |
33 |
('import_lexile', 0, 1 ) |
39 |
('import_lexile', 1, 1 ) |
34 |
}); |
40 |
} |
|
|
41 |
); |
35 |
}, |
42 |
}, |
36 |
}; |
43 |
}; |
37 |
- |
|
|