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

(-)a/installer/data/mysql/atomicupdate/bug_32132.pl (+17 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number  => "32132",
5
    description => "Set aqbudgets.budget_period_id as NOT NULL",
6
    up          => sub {
7
        my ($args) = @_;
8
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
10
        # Do you stuffs here
11
        $dbh->do(q{ALTER TABLE aqbudgets MODIFY COLUMN `budget_period_id` INT(11) NOT NULL});
12
13
        # Print useful stuff here
14
        # tables
15
        say $out "Change aqbudgets.budget_period_id to NOT accept NULL values.";
16
    },
17
};
(-)a/installer/data/mysql/kohastructure.sql (-1 / +1 lines)
Lines 559-565 CREATE TABLE `aqbudgets` ( Link Here
559
  `budget_expend` decimal(28,6) DEFAULT 0.000000 COMMENT 'budget warning at amount',
559
  `budget_expend` decimal(28,6) DEFAULT 0.000000 COMMENT 'budget warning at amount',
560
  `budget_notes` longtext DEFAULT NULL COMMENT 'notes related to this fund',
560
  `budget_notes` longtext DEFAULT NULL COMMENT 'notes related to this fund',
561
  `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this fund was last touched (created or modified)',
561
  `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this fund was last touched (created or modified)',
562
  `budget_period_id` int(11) DEFAULT NULL COMMENT 'id of the budget that this fund belongs to (aqbudgetperiods.budget_period_id)',
562
  `budget_period_id` int(11) NOT NULL COMMENT 'id of the budget that this fund belongs to (aqbudgetperiods.budget_period_id)',
563
  `sort1_authcat` varchar(80) DEFAULT NULL COMMENT 'statistical category for this fund',
563
  `sort1_authcat` varchar(80) DEFAULT NULL COMMENT 'statistical category for this fund',
564
  `sort2_authcat` varchar(80) DEFAULT NULL COMMENT 'second statistical category for this fund',
564
  `sort2_authcat` varchar(80) DEFAULT NULL COMMENT 'second statistical category for this fund',
565
  `budget_owner_id` int(11) DEFAULT NULL COMMENT 'borrowernumber of the person who owns this fund (borrowers.borrowernumber)',
565
  `budget_owner_id` int(11) DEFAULT NULL COMMENT 'borrowernumber of the person who owns this fund (borrowers.borrowernumber)',
(-)a/t/db_dependent/Koha/Acquisition/Fund.t (-2 / +10 lines)
Lines 20-25 Link Here
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 3;
22
use Test::More tests => 3;
23
use Test::Warn;
23
24
24
use t::lib::TestBuilder;
25
use t::lib::TestBuilder;
25
26
Lines 57-63 subtest 'budget ()' => sub { Link Here
57
};
58
};
58
59
59
subtest 'budget' => sub {
60
subtest 'budget' => sub {
60
    plan tests => 1;
61
    plan tests => 2;
61
62
62
    $schema->storage->txn_begin;
63
    $schema->storage->txn_begin;
63
    my $f = $builder->build_object(
64
    my $f = $builder->build_object(
Lines 70-74 subtest 'budget' => sub { Link Here
70
    is( ref( $fund->budget ),
71
    is( ref( $fund->budget ),
71
        'Koha::Acquisition::Budget',
72
        'Koha::Acquisition::Budget',
72
        '->fund should return a Koha::Acquisition::Budget object' );
73
        '->fund should return a Koha::Acquisition::Budget object' );
74
75
    # Cannot set aqbudgets.budget_period_id as NULL
76
    warning_like {
77
        eval { $fund->budget_period_id(undef)->store }
78
    }
79
    qr{.*DBD::mysql::st execute failed: Column 'budget_period_id' cannot be null.*},
80
      'DBD should have raised an error about budget_period_id that cannot be null';
81
73
    $schema->storage->txn_rollback;
82
    $schema->storage->txn_rollback;
74
};
83
};
75
- 

Return to bug 32132