Created
October 14, 2009 10:23
-
-
Save nekoya/209959 to your computer and use it in GitHub Desktop.
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
--- a/lib/DBIx/Skinny/Schema.pm | |
+++ b/lib/DBIx/Skinny/Schema.pm | |
@@ -15,7 +15,7 @@ sub import { | |
my @functions = qw/ | |
install_table | |
- schema pk columns schema_info | |
+ schema pk columns schema_info table_info | |
install_inflate_rule | |
inflate deflate call_inflate call_deflate | |
callback _do_inflate | |
@@ -182,6 +182,17 @@ sub utf8_off { | |
return $data; | |
} | |
+sub table_info { | |
+ my ($class, $table) = @_; | |
+ croak "table $table is not defined" | |
+ unless exists $class->schema->schema_info->{$table}; | |
+ my $table_info = $class->schema->schema_info->{$table}; | |
+ croak "primary key is not defined in $table" | |
+ unless $table_info->{pk}; | |
+ croak "columns is not defined in $table" | |
+ unless $table_info->{columns}; | |
+} | |
+ | |
1; | |
__END__ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment