)
},
q{
+ CREATE TYPE "dbicsl.test".pg_loader_test_enum2 AS ENUM ('wibble','wobble')
+ },
+ q{
CREATE TABLE "dbicsl.test".pg_loader_test7 (
id SERIAL PRIMARY KEY,
- value VARCHAR(100),
+ value "dbicsl.test".pg_loader_test_enum2,
six_id INTEGER UNIQUE REFERENCES "dbicsl.test".pg_loader_test6 (id)
)
},
'DROP VIEW pg_loader_test11',
],
drop => [ qw/pg_loader_test1 pg_loader_test2 pg_loader_test9 pg_loader_test10 pg_loader_test12/ ],
- count => 11 + 30 * 2, # regular + multi-schema * 2
+ count => 11 + 33 * 2, # regular + multi-schema * 2
run => sub {
my ($schema, $monikers, $classes) = @_;
lives_and {
ok $rsrc = $test_schema->source('PgLoaderTest7');
+ my $col_info = $rsrc->column_info('value');
+ is $col_info->{data_type}, 'enum',
+ 'enum column in schema name with dot';
+ is $col_info->{extra}{custom_type_name}, '"dbicsl.test".pg_loader_test_enum2',
+ 'original data type for enum in schema name with dot';
+ is_deeply $col_info->{extra}{list}, [qw(wibble wobble)],
+ 'value list for for enum in schema name with dot';
} 'got source for table in schema name with dot';
%uniqs = try { $rsrc->unique_constraints };
'unique indexes are dumped correctly';
},
},
+ cond_extra => [
+ {
+ desc => 'identity columns',
+ skip => 'requires PostgreSQL 10',
+ cond => sub { $_[0]->{pg_server_version} >= 100000 },
+ create => [
+ q{
+ create table pg_loader_test13 (
+ always integer generated always as identity,
+ by_default integer generated by default as identity
+ )
+ },
+ ],
+ drop => [ qw(pg_loader_test13) ],
+ run => sub {
+ my ($schema, $monikers, $classes) = @_;
+
+ my $rsrc13 = $schema->source($monikers->{pg_loader_test13});
+ for my $col (qw(by_default always)) {
+ my $info = $rsrc13->column_info($col);
+ (my $when = uc $col) =~ tr/_/ /;
+
+ ok $info->{is_auto_increment},
+ "is_auto_increment for GENERATED $when AS IDENTITY";
+
+ is $info->{extra}{generated_as_identity}, $col,
+ "generated_as_identity for GENERATED $when AS IDENTITY";
+ }
+ },
+ },
+ ],
)->run_tests();
END {