Skip to content

Commit

Permalink
Merge pull request #2 from dbsrgits/index-length
Browse files Browse the repository at this point in the history
Finish up the index length PR
  • Loading branch information
abeverley authored Nov 26, 2023
2 parents 79bfc70 + a2d2e6c commit 3aa5cd8
Show file tree
Hide file tree
Showing 7 changed files with 428 additions and 297 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ jobs:
- name: Set up
run: perl Makefile.PL
- name: Run Tests
run: prove -lj4 t
run: prove -lj4 t xt
2 changes: 1 addition & 1 deletion .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ jobs:
- name: Set up
run: perl Makefile.PL
- name: Run Tests
run: prove -lj4 t
run: prove -lj4 t xt
2 changes: 1 addition & 1 deletion lib/SQL/Translator/Parser/SQLite.pm
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ sub parse {
size => $fdata->{'size'},
default_value => $fdata->{'default'},
is_auto_increment => $fdata->{'is_auto_inc'},
($fdata->{'is_auto_inc'}? ( extra => { auto_increment_type => 'monotonic' } ) : ()),
($fdata->{'is_auto_inc'}? ( extra => { auto_increment_type => 'monotonic' } ) : ()),
is_nullable => $fdata->{'is_nullable'},
comments => $fdata->{'comments'},
) or die $table->error;
Expand Down
12 changes: 4 additions & 8 deletions lib/SQL/Translator/Producer/Dumper.pm
Original file line number Diff line number Diff line change
Expand Up @@ -232,17 +232,13 @@ for my $table ( @tables ) {
my @vals;
for my $fld ( @{ $table->{'fields'} } ) {
my $val = $rec->{ $fld };
if ( $table->{'types'}{ $fld } eq 'string' ) {
if ( defined $val ) {
if ( defined $val ) {
if ( $table->{'types'}{ $fld } eq 'string' ) {
$val =~ s/'/\\'/g;
$val = qq['$val']
}
else {
$val = qq[''];
}
}
else {
$val = defined $val ? $val : $mysql_loadfile ? '\N' : 'NULL';
} else {
$val = $mysql_loadfile ? '\N' : 'NULL';
}
push @vals, $val;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/SQL/Translator/Producer/JSON.pm
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ sub view_index {
return {
'name' => scalar $index->name,
'type' => scalar $index->type,
'fields' => scalar $index->fields,
'fields' => [ map { ref($_) && $_->extra && keys %{$_->extra} ? { name => $_->name, %{$_->extra} } : "$_" } $index->fields ],
'options' => scalar $index->options,
keys %{$index->extra} ? ('extra' => { $index->extra } ) : (),
};
Expand Down
2 changes: 1 addition & 1 deletion lib/SQL/Translator/Producer/YAML.pm
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ sub view_index {
'name' => scalar $index->name,
'type' => scalar $index->type,
# If the index has extra properties, make sure these are written too
'fields' => [ map { ref($_) && $_->extra && %{$_->extra} ? { name => $_->name, %{$_->extra} } : "$_" } $index->fields ],
'fields' => [ map { ref($_) && $_->extra && keys %{$_->extra} ? { name => $_->name, %{$_->extra} } : "$_" } $index->fields ],
'options' => scalar $index->options,
keys %{$index->extra} ? ('extra' => { $index->extra } ) : (),
};
Expand Down
Loading

0 comments on commit 3aa5cd8

Please sign in to comment.