Skip dumping unique indexes with expressions (RT#93613)
[dbsrgits/DBIx-Class-Schema-Loader.git] / t / 10_03pg_common.t
index e3a8b03..1da712b 100644 (file)
@@ -242,15 +242,36 @@ my $tester = dbixcsl_common_tests->new(
                         on delete restrict on update set null deferrable
                 )
             },
+            q{
+                create view pg_loader_test11 as
+                    select * from pg_loader_test1
+            },
+            q{
+                create table pg_loader_test12 (
+                    id integer not null,
+                    name text
+                )
+            },
+            q{
+                create unique index uniq_id_lc_name on pg_loader_test12 (
+                    id, lower(name)
+                )
+            },
+            q{
+                create unique index uniq_uc_name_id on pg_loader_test12 (
+                    upper(name), id
+                )
+            },
         ],
         pre_drop_ddl => [
             'DROP SCHEMA dbicsl_test CASCADE',
             'DROP SCHEMA "dbicsl-test" CASCADE',
             'DROP SCHEMA "dbicsl.test" CASCADE',
             'DROP TYPE pg_loader_test_enum',
+            'DROP VIEW pg_loader_test11',
         ],
-        drop  => [ qw/pg_loader_test1 pg_loader_test2 pg_loader_test9 pg_loader_test10/ ],
-        count => 8 + 30 * 2,
+        drop  => [ qw/pg_loader_test1 pg_loader_test2 pg_loader_test9 pg_loader_test10 pg_loader_test12/ ],
+        count => 10 + 30 * 2,
         run   => sub {
             my ($schema, $monikers, $classes) = @_;
 
@@ -440,6 +461,13 @@ my $tester = dbixcsl_common_tests->new(
                         ->has_relationship('pg_loader_test8s');
                 } 'cross-schema relationship in multi-db_schema';
             }
+
+            # test that views are marked as such
+            isa_ok $schema->resultset($monikers->{pg_loader_test11})->result_source, 'DBIx::Class::ResultSource::View',
+                'views have table_class set correctly';
+
+            is_deeply { $schema->source($monikers->{pg_loader_test12})->unique_constraints },
+                {}, 'unique indexes with expressions are not dumped';
         },
     },
 );