comparison _test/Test/SQL/Diff.pm @ 194:4d0e1962161c

Replaced tabs with spaces IMPL::Web::View - fixed document model, new features (control classes, document constructor parameters)
author cin
date Tue, 10 Apr 2012 20:08:29 +0400
parents 47dac58691ee
children 56364d0c4b4f
comparison
equal deleted inserted replaced
193:8e8401c0aea4 194:4d0e1962161c
10 use Data::Dumper; 10 use Data::Dumper;
11 11
12 __PACKAGE__->PassThroughArgs; 12 __PACKAGE__->PassThroughArgs;
13 13
14 test diff => sub { 14 test diff => sub {
15 my $schemaSrc = new IMPL::SQL::Schema(name => 'simple', version => 1 ); 15 my $schemaSrc = new IMPL::SQL::Schema(name => 'simple', version => 1 );
16 16
17 my $tbl = $schemaSrc->AddTable({ 17 my $tbl = $schemaSrc->AddTable({
18 name => 'User', 18 name => 'User',
19 columns => [ 19 columns => [
20 { name => 'name', type => Varchar(255) }, 20 { name => 'name', type => Varchar(255) },
21 { name => 'description', type => Varchar(255) } 21 { name => 'description', type => Varchar(255) }
22 ] 22 ]
23 }); 23 });
24 24
25 $tbl->AddConstraint( unique => { name => 'unique_name', columns => ['name'] }); 25 $tbl->AddConstraint( unique => { name => 'unique_name', columns => ['name'] });
26 26
27 my $schemaDst = new IMPL::SQL::Schema(name => 'simple', version => 2 ); 27 my $schemaDst = new IMPL::SQL::Schema(name => 'simple', version => 2 );
28 28
29 my $users = $schemaDst->AddTable({ 29 my $users = $schemaDst->AddTable({
30 name => 'User', 30 name => 'User',
31 columns => [ 31 columns => [
32 { name => 'id', type => Integer }, 32 { name => 'id', type => Integer },
33 { name => 'login', type => Varchar(255) }, 33 { name => 'login', type => Varchar(255) },
34 { name => 'description', type => Text, isNullable => 1 } 34 { name => 'description', type => Text, isNullable => 1 }
35 ] 35 ]
36 }); 36 });
37 37
38 $users->SetPrimaryKey('id'); 38 $users->SetPrimaryKey('id');
39 $users->AddConstraint( unique => { name => 'unique_login', columns => ['login'] } ); 39 $users->AddConstraint( unique => { name => 'unique_login', columns => ['login'] } );
40 40
41 #warn Dumper(IMPL::SQL::Schema::Traits::Diff->Diff($schemaSrc,$schemaDst)); 41 #warn Dumper(IMPL::SQL::Schema::Traits::Diff->Diff($schemaSrc,$schemaDst));
42 42
43 $schemaSrc->Dispose; 43 $schemaSrc->Dispose;
44 $schemaDst->Dispose; 44 $schemaDst->Dispose;
45 45
46 }; 46 };
47 47
48 48
49 1; 49 1;