-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sanity-check columns added as primary key
- Loading branch information
Showing
3 changed files
with
45 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
use strict; | ||
use warnings; | ||
use Test::More; | ||
use Test::Exception; | ||
use Test::Warn; | ||
|
||
use lib 't/lib'; | ||
use DBICTest; | ||
|
||
throws_ok { | ||
package Foo; | ||
use base 'DBIx::Class::Core'; | ||
__PACKAGE__->table('foo'); | ||
__PACKAGE__->set_primary_key('bar') | ||
} qr/No such column 'bar' on source 'foo' /, | ||
'proper exception on non-existing column as PK'; | ||
|
||
warnings_exist { | ||
package Foo2; | ||
use base 'DBIx::Class::Core'; | ||
__PACKAGE__->table('foo'); | ||
__PACKAGE__->add_columns( | ||
foo => {}, | ||
bar => { is_nullable => 1 }, | ||
); | ||
__PACKAGE__->set_primary_key(qw(foo bar)) | ||
} qr/Primary key of source 'foo' includes the column 'bar' which has its 'is_nullable' attribute set to true/, | ||
'proper exception on non-existing column as PK'; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
||
|
||
done_testing; |
This should be s/non-existing/NULLable/