Subject: | Pg is hardwired into instantcrud.pl script |
instantcrud.pl has Pg hardcoded as the PK generator. This isn't
necessary nor is it desirable. I've attached a patch which attempts to
match the PK call with the database given in the DSN. It works for
SQLite (and Pg). I can't test it on any other dbs.
Subject: | pkautofix.txt |
*** /usr/bin/instantcrud.pl 2006-04-04 14:07:36.000000000 +1000
--- instantcrud.pl 2006-03-30 22:30:22.000000000 +1000
***************
*** 84,90 ****
my $appfilecont = read_file($appfile);
$appfilecont =~ s{use Catalyst qw/(.*)/}
! {use Catalyst qw/$1 DefaultEnd/};
write_file($appfile, $appfilecont) or die "Cannot write main application file";
--- 84,90 ----
my $appfilecont = read_file($appfile);
$appfilecont =~ s{use Catalyst qw/(.*)/}
! {use Catalyst qw/\1 DefaultEnd/};
write_file($appfile, $appfilecont) or die "Cannot write main application file";
***************
*** 111,117 ****
my @columns = $c->columns;
my @pk = $c->primary_columns();
my $primary_key = $pk[0];
- my ($dbdtype) = ($dsn =~ /dbi:([^:]+)/);
my $model = qq{
package $c;
--- 111,116 ----
***************
*** 119,125 ****
use warnings;
use base 'DBIx::Class';
! __PACKAGE__->load_components(qw/PK::Auto::$dbdtype Core/);
__PACKAGE__->table('$table');
__PACKAGE__->add_columns(qw/@columns/);
__PACKAGE__->set_primary_key('$primary_key');
--- 118,124 ----
use warnings;
use base 'DBIx::Class';
! __PACKAGE__->load_components(qw/PK::Auto::Pg Core/);
__PACKAGE__->table('$table');
__PACKAGE__->add_columns(qw/@columns/);
__PACKAGE__->set_primary_key('$primary_key');