Create/alter tables before foreign key changes
authorIvan Kohler <ivan@freeside.biz>
Mon, 4 Nov 2013 22:56:40 +0000 (14:56 -0800)
committerIvan Kohler <ivan@freeside.biz>
Mon, 4 Nov 2013 22:56:40 +0000 (14:56 -0800)
DBSchema/Table.pm

index b150d30..bf07f0b 100644 (file)
@@ -669,8 +669,9 @@ sub sql_alter_table {
 
 =item sql_alter_constraints PROTOTYPE_TABLE, [ DATABASE_HANDLE | DATA_SOURCE [ USERNAME PASSWORD [ ATTR ] ] ]
 
 
 =item sql_alter_constraints PROTOTYPE_TABLE, [ DATABASE_HANDLE | DATA_SOURCE [ USERNAME PASSWORD [ ATTR ] ] ]
 
-Returns a list of SQL statements to alter this table so that it is identical
-to the provided table, also a DBIx::DBSchema::Table object.
+Returns a list of SQL statements to alter this table's constraints (foreign
+keys) so that they are identical to the provided table, also a
+DBIx::DBSchema::Table object.
 
 The data source can be specified by passing an open DBI database handle, or by
 passing the DBI data source name, username and password.  
 
 The data source can be specified by passing an open DBI database handle, or by
 passing the DBI data source name, username and password.  
@@ -691,8 +692,6 @@ specified database, will attempt to use generic SQL syntax.
 
 =cut
 
 
 =cut
 
-#gosh, false laziness w/DBSchema::sql_update_schema
-
 sub sql_alter_constraints {
   my($self, $opt, $new, $dbh) = ( shift, _parse_opt(\@_), shift, _dbh(@_) );
 
 sub sql_alter_constraints {
   my($self, $opt, $new, $dbh) = ( shift, _parse_opt(\@_), shift, _dbh(@_) );
 
@@ -713,8 +712,10 @@ sub sql_alter_constraints {
     push @at, 'ADD '. $foreign_key->sql_foreign_key;
   }
 
     push @at, 'ADD '. $foreign_key->sql_foreign_key;
   }
 
-  # XXX foreign keys modify / drop
-  
+  ###
+  # XXX TODO foreign keys modify / drop
+  ###
+
   return () unless @at;
   (
     'ALTER TABLE '. $self->name. ' '. join(",\n  ", @at) 
   return () unless @at;
   (
     'ALTER TABLE '. $self->name. ' '. join(",\n  ", @at)