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.
33 # be compatible with Class::DBI::UUID
37 die "column $_ doesn't exist" unless $self->has_column($_);
39 $self->uuid_auto_columns(\@_);
44 for my $column (@{$self->uuid_auto_columns}) {
45 $self->store_column( $column, $self->get_uuid )
46 unless defined $self->get_column( $column );
52 return Data::UUID->new->to_string(Data::UUID->new->create),
59 Chia-liang Kao <clkao@clkao.org>
63 You may distribute this code under the same terms as Perl itself.