From: Peter Rabbitson Date: Wed, 7 May 2008 16:37:56 +0000 (+0000) Subject: Various fixes to make testing with DBICTEST_SQLT_DEPLOY=1 possible X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=458e02924eea223d6aa49bf45abbb7fdd05d909f;p=dbsrgits%2FDBIx-Class-Historic.git Various fixes to make testing with DBICTEST_SQLT_DEPLOY=1 possible --- diff --git a/t/86sqlt.t b/t/86sqlt.t index 513a9b6..366f907 100644 --- a/t/86sqlt.t +++ b/t/86sqlt.t @@ -207,28 +207,28 @@ my %fk_constraints = ( long_columns => [ { 'display' => 'long_columns->owner', - 'name' => 'long_columns_fk_64_character_column_aaaaaaaaaaaaaaaaaaa_1ca973e2', - 'index_name' => '64_character_column_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', + 'name' => 'long_columns_fk__64_character_column_aaaaaaaaaaaaaaaaaa_cfc8d5b0', + 'index_name' => '_64_character_column_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'selftable' => 'long_columns', 'foreigntable' => 'long_columns', - 'selfcols' => ['64_character_column_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'], + 'selfcols' => ['_64_character_column_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'], 'foreigncols' => ['lcid'], on_delete => '', on_update => '', deferrable => 1, }, { 'display' => 'long_columns->owner2', - 'name' => 'long_columns_fk_32_character_column_aaaaaaaaaaaa_32_cha_6060a8f3', - 'index_name' => '32_character_column_aaaaaaaaaaaa_32_character_column_bb_30f7a7fe', + 'name' => 'long_columns_fk__32_character_column_aaaaaaaaaaa__32_ch_12bdb9cf', + 'index_name' => '_32_character_column_aaaaaaaaaaa__32_character_column_b_6fa7ff05', 'selftable' => 'long_columns', 'foreigntable' => 'long_columns', - 'selfcols' => ['32_character_column_bbbbbbbbbbbb', '32_character_column_aaaaaaaaaaaa'], - 'foreigncols' => ['32_character_column_aaaaaaaaaaaa', '32_character_column_bbbbbbbbbbbb'], + 'selfcols' => ['_32_character_column_bbbbbbbbbbb', '_32_character_column_aaaaaaaaaaa'], + 'foreigncols' => ['_32_character_column_aaaaaaaaaaa', '_32_character_column_bbbbbbbbbbb'], on_delete => '', on_update => '', deferrable => 1, }, { 'display' => 'long_columns->owner3', - 'name' => 'long_columns_fk_16_character_col', - 'index_name' => '16_character_col', + 'name' => 'long_columns_fk__16_chars_column', + 'index_name' => '_16_chars_column', 'selftable' => 'long_columns', 'foreigntable' => 'long_columns', - 'selfcols' => ['16_character_col'], 'foreigncols' => ['8_char_c'], + 'selfcols' => ['_16_chars_column'], 'foreigncols' => ['_8_chr_c'], on_delete => '', on_update => '', deferrable => 1, }, ], @@ -256,23 +256,23 @@ my %unique_constraints = ( long_columns => [ { 'display' => 'long but not quite truncated unique', - 'name' => 'long_columns_16_character_col_32_character_column_aaaaaaaaaaaa', - 'table' => 'long_columns', 'cols' => [qw( 32_character_column_aaaaaaaaaaaa 16_character_col )], + 'name' => 'long_columns__16_chars_column__32_character_column_aaaaaaaaaaa', + 'table' => 'long_columns', 'cols' => [qw( _32_character_column_aaaaaaaaaaa _16_chars_column )], }, { 'display' => 'multi column truncated unique', - 'name' => 'long_columns_8_char_c_16_character_col_32_character_col_ee4a438c', - 'table' => 'long_columns', 'cols' => [qw( 32_character_column_aaaaaaaaaaaa 16_character_col 8_char_c )], + 'name' => 'long_columns__8_chr_c__16_chars_column__32_character_co_004ce318', + 'table' => 'long_columns', 'cols' => [qw( _32_character_column_aaaaaaaaaaa _16_chars_column _8_chr_c )], }, { 'display' => 'different multi column truncated unique with same base', - 'name' => 'long_columns_8_char_c_16_character_col_32_character_col_c5dbc7a7', - 'table' => 'long_columns', 'cols' => [qw( 32_character_column_bbbbbbbbbbbb 16_character_col 8_char_c )], + 'name' => 'long_columns__8_chr_c__16_chars_column__32_character_co_25773323', + 'table' => 'long_columns', 'cols' => [qw( _32_character_column_bbbbbbbbbbb _16_chars_column _8_chr_c )], }, { 'display' => 'single column truncated unique', - 'name' => 'long_columns_64_character_column_aaaaaaaaaaaaaaaaaaaaaa_095dc664', - 'table' => 'long_columns', 'cols' => ['64_character_column_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'], + 'name' => 'long_columns__64_character_column_aaaaaaaaaaaaaaaaaaaaa_0acf5172', + 'table' => 'long_columns', 'cols' => ['_64_character_column_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'], }, ], @@ -306,8 +306,8 @@ my %indexes = ( my $tschema = $translator->schema(); # Test that the $schema->sqlt_deploy_hook was called okay and that it removed -# the 'link' table -ok( !defined($tschema->get_table('link')), "Link table was removed by hook"); +# the 'dummy' table +ok( !defined($tschema->get_table('dummy')), "Dummy table was removed by hook"); # Test that nonexistent constraints are not found my $constraint = get_constraint('FOREIGN KEY', 'cd', ['title'], 'cd', ['year']); diff --git a/t/lib/DBICTest/Schema.pm b/t/lib/DBICTest/Schema.pm index a07db60..d1a86bd 100644 --- a/t/lib/DBICTest/Schema.pm +++ b/t/lib/DBICTest/Schema.pm @@ -45,7 +45,7 @@ __PACKAGE__->load_classes(qw/ sub sqlt_deploy_hook { my ($self, $sqlt_schema) = @_; - $sqlt_schema->drop_table('link'); + $sqlt_schema->drop_table('dummy'); } 1; diff --git a/t/lib/DBICTest/Schema/Dummy.pm b/t/lib/DBICTest/Schema/Dummy.pm new file mode 100644 index 0000000..6bc51d6 --- /dev/null +++ b/t/lib/DBICTest/Schema/Dummy.pm @@ -0,0 +1,23 @@ +package # hide from PAUSE + DBICTest::Schema::Dummy; + +use base 'DBIx::Class::Core'; + +use strict; +use warnings; + +__PACKAGE__->table('dummy'); +__PACKAGE__->add_columns( + 'id' => { + data_type => 'integer', + is_auto_increment => 1 + }, + 'gittery' => { + data_type => 'varchar', + size => 100, + is_nullable => 1, + }, +); +__PACKAGE__->set_primary_key('id'); + +1; diff --git a/t/lib/DBICTest/Schema/LongColumns.pm b/t/lib/DBICTest/Schema/LongColumns.pm index 3505410..e0ab829 100644 --- a/t/lib/DBICTest/Schema/LongColumns.pm +++ b/t/lib/DBICTest/Schema/LongColumns.pm @@ -1,4 +1,4 @@ -package # hide from PAUSE +package # hide from PAUSE DBICTest::Schema::LongColumns; use base qw/DBIx::Class::Core/; @@ -9,38 +9,38 @@ __PACKAGE__->add_columns( data_type => 'int', is_auto_increment => 1, }, - '64_character_column_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' => { + '_64_character_column_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' => { data_type => 'int', }, - '32_character_column_aaaaaaaaaaaa' => { + '_32_character_column_aaaaaaaaaaa' => { data_type => 'int', }, - '32_character_column_bbbbbbbbbbbb' => { + '_32_character_column_bbbbbbbbbbb' => { data_type => 'int', }, - '16_character_col' => { + '_16_chars_column' => { data_type => 'int', }, - '8_char_c' => { + '_8_chr_c' => { data_type => 'int', }, ); __PACKAGE__->set_primary_key('lcid'); -__PACKAGE__->add_unique_constraint([qw( 16_character_col 32_character_column_aaaaaaaaaaaa )]); +__PACKAGE__->add_unique_constraint([qw( _16_chars_column _32_character_column_aaaaaaaaaaa )]); -__PACKAGE__->add_unique_constraint([qw( 8_char_c 16_character_col 32_character_column_aaaaaaaaaaaa )]); +__PACKAGE__->add_unique_constraint([qw( _8_chr_c _16_chars_column _32_character_column_aaaaaaaaaaa )]); -__PACKAGE__->add_unique_constraint([qw( 8_char_c 16_character_col 32_character_column_bbbbbbbbbbbb )]); +__PACKAGE__->add_unique_constraint([qw( _8_chr_c _16_chars_column _32_character_column_bbbbbbbbbbb )]); -__PACKAGE__->add_unique_constraint([qw( 64_character_column_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa )]); +__PACKAGE__->add_unique_constraint([qw( _64_character_column_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa )]); __PACKAGE__->belongs_to( 'owner', 'DBICTest::Schema::LongColumns', { - 'foreign.lcid' => 'self.64_character_column_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', + 'foreign.lcid' => 'self._64_character_column_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', }, ); @@ -48,8 +48,8 @@ __PACKAGE__->belongs_to( 'owner2', 'DBICTest::Schema::LongColumns', { - 'foreign.32_character_column_aaaaaaaaaaaa' => 'self.32_character_column_bbbbbbbbbbbb', - 'foreign.32_character_column_bbbbbbbbbbbb' => 'self.32_character_column_aaaaaaaaaaaa', + 'foreign._32_character_column_aaaaaaaaaaa' => 'self._32_character_column_bbbbbbbbbbb', + 'foreign._32_character_column_bbbbbbbbbbb' => 'self._32_character_column_aaaaaaaaaaa', }, ); @@ -57,7 +57,7 @@ __PACKAGE__->belongs_to( 'owner3', 'DBICTest::Schema::LongColumns', { - 'foreign.8_char_c' => 'self.16_character_col', + 'foreign._8_chr_c' => 'self._16_chars_column', }, );