tiny bit of cleanup
authorivan <ivan>
Mon, 28 Nov 2005 13:18:35 +0000 (13:18 +0000)
committerivan <ivan>
Mon, 28 Nov 2005 13:18:35 +0000 (13:18 +0000)
DBSchema/Column.pm
DBSchema/Table.pm

index 363c98c..6c55735 100644 (file)
@@ -277,7 +277,7 @@ sub line {
   if ( $driver eq 'mysql' ) { #yucky mysql hack
     $null ||= "NOT NULL";
     $self->local('AUTO_INCREMENT') if uc($self->type) eq 'SERIAL';
-  } elsif ( $driver =~ /^(?:Pg|SQLite)$/ ) { #yucky Pg hack
+  } elsif ( $driver =~ /^(?:Pg|SQLite)$/ ) { #yucky Pg/SQLite hack
     $null ||= "NOT NULL";
     $null =~ s/^NULL$//;
   }
index 70b2cdf..0fa0bbf 100644 (file)
@@ -391,10 +391,7 @@ sub sql_create_table {
   my @columns = map { $self->column($_)->line($dbh) } $self->columns;
 
   push @columns, "PRIMARY KEY (". $self->primary_key. ")"
-    #if $self->primary_key && $driver ne 'Pg';
-    # SQLite needs to declare its autoincrementing columns as PRIMARY KEYS inline
-    # otherwise they have no magic
-    if ($self->primary_key and not ( grep { /PRIMARY KEY/ } @columns));
+    if $self->primary_key && ! grep /PRIMARY KEY/i, @columns;
 
   my $indexnum = 1;