Update example Result classes for proper DDL generation
[dbsrgits/DBIx-Class.git] / examples / Schema / MyApp / Schema / Result / Artist.pm
index 61a11f2..70074b1 100644 (file)
@@ -3,14 +3,24 @@ package MyApp::Schema::Result::Artist;
 use warnings;
 use strict;
 
-use base qw/DBIx::Class::Core/;
+use base qw( DBIx::Class::Core );
 
 __PACKAGE__->table('artist');
 
-__PACKAGE__->add_columns(qw/ artistid name /);
+__PACKAGE__->add_columns(
+  artistid => {
+    data_type => 'integer',
+    is_auto_increment => 1
+  },
+  name => {
+    data_type => 'text',
+  },
+);
 
 __PACKAGE__->set_primary_key('artistid');
 
+__PACKAGE__->add_unique_constraint([qw( name )]);
+
 __PACKAGE__->has_many('cds' => 'MyApp::Schema::Result::Cd');
 
 1;