1 package DBIx::Class::UUIDColumns;
2 use base qw/DBIx::Class/;
6 __PACKAGE__->mk_classdata( 'uuid_auto_columns' => [] );
10 DBIx::Class::UUIDColumns - Implicit uuid columns
15 __PACKAGE__->load_components(qw/UUIDColumns Core DB/);
16 __PACKAGE__->uuid_columns( 'artist_id' );x
20 This L<DBIx::Class> component resambles the behaviour of
21 L<Class::DBI::UUID>, to make some columns implicitly created as uuid.
23 Note that the component needs to be loaded before Core.
31 # be compatible with Class::DBI::UUID
35 die "column $_ doesn't exist" unless $self->has_column($_);
37 $self->uuid_auto_columns(\@_);
42 for my $column (@{$self->uuid_auto_columns}) {
43 $self->store_column( $column, $self->get_uuid )
44 unless defined $self->get_column( $column );
50 return Data::UUID->new->to_string(Data::UUID->new->create),
55 Chia-liang Kao <clkao@clkao.org>
59 You may distribute this code under the same terms as Perl itself.