1 package DBIx::Class::UUIDColumns;
2 use base qw/DBIx::Class/;
8 __PACKAGE__->mk_classdata( 'uuid_auto_columns' => [] );
12 DBIx::Class::UUIDColumns - Implicit uuid columns
17 __PACKAGE__->load_components(qw/UUIDColumns Core DB/);
18 __PACKAGE__->uuid_columns( 'artist_id' );x
22 This L<DBIx::Class> component resambles the behaviour of
23 L<Class::DBI::UUID>, to make some columns implicitly created as uuid.
25 Note that the component needs to be loaded before Core.
33 # be compatible with Class::DBI::UUID
37 croak "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 );
48 $self->next::method(@_);
52 return Data::UUID->new->to_string(Data::UUID->new->create),
57 Chia-liang Kao <clkao@clkao.org>
61 You may distribute this code under the same terms as Perl itself.