Re-adding sequence to raw table not working
[dbsrgits/DBIx-Class-ResultSource-MultipleTableInheritance.git] / lib / DBIx / Class / ResultSource / MultipleTableInheritance.pm
index 9dceab6..cfeb9c0 100644 (file)
@@ -164,6 +164,15 @@ method attach_additional_sources () {
         $self->columns
   );
   $table->set_primary_key($self->primary_columns);
+  
+  # Attempting to re-add sequence here -- AKB
+  for my $pk ( $self->primary_columns ) {
+    $table->columns_info->{$pk}->{sequence} =
+      $self->set_sequence( $table->name, $self->primary_columns )
+      unless grep {
+      $table->columns_info->{$_}->{originally_defined_in} ne $self->name
+      } keys %{ $table->columns_info };
+  }
 
   # we need to copy our rels to the raw object as well
   # note that ->add_relationship on a source object doesn't create an
@@ -224,6 +233,10 @@ method set_primary_key (@args) {
   return $self->next::method(@args);
 }
 
+method set_sequence ($table_name, @pks) {
+  return $table_name . '_' . join('_',@pks) . '_' . 'seq';
+}
+
 method raw_source_name () {
   my $base = $self->source_name;
   confess "Can't generate raw source name for ${\$self->name} when we don't have a source_name"