From 8fc342d5730936e6de18df0690158923e151da6d Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 29 Jun 2007 01:50:07 +0000 Subject: [PATCH] 0.33 --- Changes | 4 ++-- DBSchema.pm | 4 ++-- DBSchema/Table.pm | 18 ++++++++++++++++++ 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/Changes b/Changes index d7cc9cb..ff6c70c 100644 --- a/Changes +++ b/Changes @@ -1,8 +1,8 @@ Revision history for Perl extension DBIx::DBSchema. -0.33 unreleased +0.33 Thu Jun 28 18:46:15 PDT 2007 - Overhaul of index representation: indices (both normal and unique) - are now named DBIx::DBSchema::Index objects + now have names and are DBIx::DBSchema::Index objects - update_schema now handles indices! - Bump version numbers in Table.pm, Column.pm and DBD.pm - Pg reverse-engineering fix for column order in multi-column indices, diff --git a/DBSchema.pm b/DBSchema.pm index 43baaaf..95ac630 100644 --- a/DBSchema.pm +++ b/DBSchema.pm @@ -10,8 +10,8 @@ use DBIx::DBSchema::Column; use DBIx::DBSchema::ColGroup::Unique; use DBIx::DBSchema::ColGroup::Index; -$VERSION = "0.33_01"; -$VERSION = eval $VERSION; # modperlstyle: convert the string into a number +$VERSION = "0.33"; +#$VERSION = eval $VERSION; # modperlstyle: convert the string into a number $DEBUG = 0; diff --git a/DBSchema/Table.pm b/DBSchema/Table.pm index 3679965..a51acc8 100644 --- a/DBSchema/Table.pm +++ b/DBSchema/Table.pm @@ -452,6 +452,24 @@ sub indices { : (); } +=item unique_singles + +Meet exciting and unique singles using this method! + +This method returns a list of column names that are indexed with their own, +unique, non-compond (that's the "single" part) indices. + +=cut + +sub unique_singles { + my $self = shift; + my %indices = $self->indices; + + map { ${ $indices{$_}->columns }[0] } + grep { $indices{$_}->unique && scalar(@{$indices{$_}->columns}) == 1 } + keys %indices; +} + =item sql_create_table [ DATABASE_HANDLE | DATA_SOURCE [ USERNAME PASSWORD [ ATTR ] ] ] Returns a list of SQL statments to create this table. -- 2.11.0