projects
/
DBIx-DBSchema.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ca90218
)
0.33
author
ivan
<ivan>
Fri, 29 Jun 2007 01:50:07 +0000
(
01:50
+0000)
committer
ivan
<ivan>
Fri, 29 Jun 2007 01:50:07 +0000
(
01:50
+0000)
Changes
patch
|
blob
|
history
DBSchema.pm
patch
|
blob
|
history
DBSchema/Table.pm
patch
|
blob
|
history
diff --git
a/Changes
b/Changes
index
d7cc9cb
..
ff6c70c
100644
(file)
--- a/
Changes
+++ b/
Changes
@@
-1,8
+1,8
@@
Revision history for Perl extension DBIx::DBSchema.
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)
- 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,
- 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
(file)
--- a/
DBSchema.pm
+++ b/
DBSchema.pm
@@
-10,8
+10,8
@@
use DBIx::DBSchema::Column;
use DBIx::DBSchema::ColGroup::Unique;
use DBIx::DBSchema::ColGroup::Index;
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;
$DEBUG = 0;
diff --git
a/DBSchema/Table.pm
b/DBSchema/Table.pm
index
3679965
..
a51acc8
100644
(file)
--- 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.
=item sql_create_table [ DATABASE_HANDLE | DATA_SOURCE [ USERNAME PASSWORD [ ATTR ] ] ]
Returns a list of SQL statments to create this table.