I think there is probably a better way—and I’d like to know one but don’t have time to code dive, play—but this kind of thing should work.
use warnings; no warnings "uninitialized"; use strict; use MyApp::Schema; my $schema = MyApp::Schema->connect("dbi:SQLite::memory:"); my ( $first_source ) = $schema->sources; my $ok = eval { $schema->resultset($first_source)->count || 1; }; if ( $@ =~ /no such table/ ) { warn $@; print "Trying to deploy...\n"; $schema->deploy; $schema->resultset($first_source)->count; print "Deploy seems good!\n"; } elsif ( not $ok ) { die $@ || "Uh... something bad, something, something\n"; }
In reply to Re^3: Database-independent means of creating database?
by Your Mother
in thread Database-independent means of creating database?
by unix_hacker_beard
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |