Getting the schema for a DB table

Simon Wistow simon at thegestalt.org
Tue May 27 22:18:32 BST 2014


On Tue, May 27, 2014 at 08:20:02PM +0200, Thomas Klausner said:
> Hi!

Wotcha!
 
> Well, we use DBIx::SchemaChecksum in some utility scripts that are 
> invoked maybe once a day per hand (and quite often less than that).
> 
> So neither process size nor start up time was an issue when writing it.

Understood - and don't get me wrong. I think it's good code that does 
almost exactly what I want (and is probably far more correct in that it 
copes with triggers and a whole bunch more) apart from the lack of 
MySQL support.

Also: Moose appears to be far less heavyweight than it used to be - 
startup time was 'only' 225ms with a warm disk cache (as opposed to 4ms 
without or 10ms with DBI). 

> I've never had problems with installing deps since cpanm came out.

Installing dependencies isn't the problem per se (although every new 
dependency increases the likelyhood that the install will fail at 
somepoint) - it's managing dependencies as they get upgraded and start 
to interact. 

At best you freeze the dependency tree in time, mandate specific 
versions and then deal with any problems platform changes have in the 
future but 
 
> But I agree that one could extract the actual DBI introspection and 
> checksumming code into a lean and low-on-deps-distribution, and then 
> pack this dist into the command-line-utiltiy thing. Patches welcome :-)

I posted my dirty code here 

https://gist.github.com/simonwistow/480b62d904e397e38a85

It's not as complete as your approach

I suspect we're both attacking a similar problems - I was attempting to 
write a database migrator that

- didn't need an ORM
- could do both Serial based migrations (a la ActiveRecord::Migration) 
  and hash based
- was extensible
- was lightweight

All this was out of curiosity as much as anything else - it was a 
holiday weekend here in the US and I don't get to do much coding anymore 
so I was looking for a project.

Simon



More information about the london.pm mailing list