password => $odbc_password,
} : ()),
],
+ data_types => {
+ 'int identity' => { data_type => 'int', is_auto_increment => 1 },
+ },
extra => {
create => [
q{
CREATE VIEW mssql_loader_test4 AS
SELECT * FROM mssql_loader_test3
},
+ # test capitalization of cols in unique constraints
+ q{
+ CREATE TABLE mssql_loader_test5 (
+ id INT IDENTITY NOT NULL PRIMARY KEY,
+ FooCol INT NOT NULL,
+ BarCol INT NOT NULL,
+ UNIQUE (FooCol, BarCol)
+ )
+ },
],
pre_drop_ddl => [
'CREATE TABLE mssql_loader_test3 (id INT IDENTITY NOT NULL PRIMARY KEY)',
],
drop => [
'[mssql_loader_test1.dot]',
- 'mssql_loader_test3'
+ 'mssql_loader_test3',
+ 'mssql_loader_test5',
],
- count => 8,
+ count => 9,
run => sub {
my ($schema, $monikers, $classes) = @_;
is eval { $$from }, "[mssql_loader_test1.dot]",
'->table with dot in name has correct name';
-# Test that identity columns do not have 'identity' in the data_type, and do
-# have is_auto_increment.
- my $identity_col_info = $schema->resultset($monikers->{loader_test10})
- ->result_source->column_info('id10');
+# Test capitalization of columns and unique constraints
+ ok ((my $rsrc = $schema->resultset($monikers->{mssql_loader_test5})->result_source),
+ 'got result_source');
+
+ is $rsrc->column_info('foocol')->{data_type}, 'int',
+ 'column names are lowercased';
- is $identity_col_info->{data_type}, 'int',
- q{'INT IDENTITY' column has data_type => 'int'};
+ my %uniqs = $rsrc->unique_constraints;
+ delete $uniqs{primary};
- is $identity_col_info->{is_auto_increment}, 1,
- q{'INT IDENTITY' column has is_auto_increment => 1};
+ is_deeply ((values %uniqs)[0], [qw/foocol barcol/],
+ 'columns in unique constraint lowercased');
# Test that a bad view (where underlying table is gone) is ignored.
my $dbh = $schema->storage->dbh;
$warn_count++ for grep /renaming \S+ relation/, @loader_warnings;
- my $vendor = $self->{vendor};
- $warn_count++ for grep /${vendor}_\S+ has no primary key/,
- @loader_warnings;
-
$warn_count++ for grep /\b(?!loader_test9)\w+ has no primary key/i, @loader_warnings;
if($self->{skip_rels}) {
$dbh->do($_) for (@statements);
- $dbh->do($self->{data_type_tests}{ddl}) if $self->{data_type_tests};
+ $dbh->do($self->{data_type_tests}{ddl}) if $self->{data_type_tests}{ddl};
unless($self->{skip_rels}) {
# hack for now, since DB2 doesn't like inline comments, and we need