View | Details | Raw Unified | Return to bug 35657
Collapse All | Expand All

(-)a/installer/data/mysql/atomicupdate/bug_35657.pl (-1 / +42 lines)
Line 0 Link Here
0
- 
1
use Modern::Perl;
2
3
return {
4
    bug_number  => "35657",
5
    description => "Add assignee_id to tickets",
6
    up          => sub {
7
        my ($args) = @_;
8
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
10
        unless ( column_exists( 'tickets', 'assignee_id' ) ) {
11
            $dbh->do(
12
                q{
13
                ALTER TABLE tickets ADD COLUMN assignee_id int(11) DEFAULT NULL COMMENT 'id of the user this ticket is assigned to' AFTER status
14
            }
15
            );
16
            $dbh->do(
17
                q{
18
                ALTER TABLE tickets
19
                ADD CONSTRAINT `tickets_ibfk_4` FOREIGN KEY (`assignee_id`)
20
                REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
21
            }
22
            );
23
            say $out "Added column 'tickets.assignee_id'";
24
        }
25
26
        unless ( column_exists( 'ticket_updates', 'assignee_id' ) ) {
27
            $dbh->do(
28
                q{
29
                ALTER TABLE ticket_updates ADD COLUMN assignee_id int(11) DEFAULT NULL COMMENT 'id of the user this ticket was assigned to with this update' AFTER user_id
30
            }
31
            );
32
            $dbh->do(
33
                q{
34
                ALTER TABLE ticket_updates
35
                ADD CONSTRAINT `ticket_updates_ibfk_4` FOREIGN KEY (`assignee_id`)
36
                REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
37
            }
38
            );
39
            say $out "Added column 'ticket_updates.assignee_id'";
40
        }
41
    },
42
};

Return to bug 35657