Getting the schema for a DB table

Thomas Klausner domm at
Sun May 25 18:38:54 BST 2014


On Sun, May 25, 2014 at 05:46:45PM +0100, Simon Wistow wrote:
> Alternatively - what I'm really trying to do is get a unique finger 
> print for the schema of a database. My current plan is hashing the 
> CREATE TABLE statement but other methods would be gratefully received.

If you want a hash of the current DB schema, take a look at 

We use it to automate DB updates (but this will only work for DBs which 
can create tables inside a transcation, i.e. Postgres and sqlite, but 
neither Oracle nor MySQL).

It also comes with a script, which you could use like this to get the 
checksum: checksum --dsn dbi:Pg:dbname=your_db

To show the data on which the checksum is based: checksum --dsn dbi:Pg:dbname=your_db --show_dum

Not sure if this is what you're after, but I hope it helps..


for(ref bless{},just'another'perl'hacker){s-:+-$"-g&&print$_.$/}

More information about the mailing list