[Dbix-class] Patch for SQL::Translator::Parser::DBIx::Class

Sebastian Willert willert at gmail.com
Mon Jun 26 16:16:40 CEST 2006


On Mon, 2006-06-26 at 14:35 +0100, Matt S Trout wrote:
> Sebastian Willert wrote:
> > Actually, that was kind of my initial intention, after I ran into
> > trouble using deploy(), which seems to need a run-time connection before
> > being called. (Regarding your next post: the problems might have easily
> > been caused by missing data_types in the schema, yes)
> 
> Well, that's what deploy() is *for* - deploying to the database you're 
> connected to.

Yeah I know, the problem arises when you try to deploy to the database
but have missing data_types. The SQLT::Parser::DBIC tries to read them
from the table, which isn't in place yet and thus dies loudly (with
'Unknown table XXX', IIRC ), while the process keeps running because the
call is wrapped in an eval{}. This is very confusing behaviour, and I'd
rather have a 'No data_type for X has been found and could not be
guessed from DB' kind of warning. Together with SQLite silently changing
their binary format from 3.2 (my distros command-line tool) to 3.3
(DBD::SQLites 1.12 internal one) and thus dumping the created DB yielded
no generated tables at all (but no warning about incompatible file
formats, whatsoever), I was under the impression that something in there
was really wrong.

> > If this is the case, the correct approach would be to warn (or even
> > die?) in SQLT::Parser::DBIC in a situation where data_type is unknown
> > and no table information can be retrieved? And some docs regarding
> > SQLT::Parser::DBIC, DBIC::Schema::deploy() and about testing schemas in
> > general?
> 
> Good thought, and yes please.
> 
> > I think I could try to do some of this, but I've seen that my
> > understanding of DBIC still sucks, so I am not very confident :(
> 
> Nah, you just missed out on a particular subtlety. In any case, while 
> incomplete/incorrect docs on CPAN might be a bad thing the phrase "you've got 
> to start somewhere" springs to mind - and we'd be more than happy to help with 
> editing, tweaking and corrections. Make a start, RFC it to the list and see 
> what people think - worst case scenario you've learned more about DBIC :)

Thanks, I'll try to find some time in the next days, there a busy week
ahead of me.

Cheers,
  Sebastian




More information about the Dbix-class mailing list