Skip to content

Instantly share code, notes, and snippets.

@nekoya
Created October 14, 2009 10:23
Show Gist options
  • Save nekoya/209959 to your computer and use it in GitHub Desktop.
Save nekoya/209959 to your computer and use it in GitHub Desktop.
--- 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