diff _test/Test/SQL/Diff.pm @ 169:fd92830036c3

corrected IMPL::SQL::Schema::Diff
author sourcer
date Tue, 17 May 2011 00:04:28 +0400
parents 6148f89bb7bf
children d1676be8afcc
line wrap: on
line diff
--- a/_test/Test/SQL/Diff.pm	Mon May 16 04:30:38 2011 +0400
+++ b/_test/Test/SQL/Diff.pm	Tue May 17 00:04:28 2011 +0400
@@ -14,13 +14,16 @@
 test diff => sub {
 	my $schemaSrc = new IMPL::SQL::Schema(name => 'simple', version => 1 );
 	
-	$schemaSrc->AddTable({
+	my $tbl = $schemaSrc->AddTable({
 		name => 'User',
 		columns => [
-			{ name => 'name', type => Varchar(255) }
+			{ name => 'name', type => Varchar(255) },
+			{ name => 'description', type => Varchar(255) }
 		]
 	});
 	
+	$tbl->AddConstraint( unique => { name => 'unique_name', columns => ['name'] });
+	
 	my $schemaDst = new IMPL::SQL::Schema(name => 'simple', version => 2 );
 	
 	my $users = $schemaDst->AddTable({
@@ -33,7 +36,7 @@
 	});
 	
 	$users->SetPrimaryKey('id');
-	$users->AddConstraint( unique => { name => 'unique_user_login', columns => ['login'] } );
+	$users->AddConstraint( unique => { name => 'unique_login', columns => ['login'] } );
 	
 	warn Dumper(IMPL::SQL::Schema::Traits::Diff->Diff($schemaSrc,$schemaDst));