Skip to content

Commit 39e00ab

Browse files
authored
Round-trip AUTOINCREMENT in SQLite parser (#158)
Currently, the SQLite parser sees the AUTOINCREMENT keyword and sets the column flag is_auto_increment, but the SQLite Producer will not write the AUTOINCREMENT keyword unless extra.auto_increment_type is 'monotonic'. This breaks round-trip by the AUTOINCREMENT keyword getting lost.
1 parent c74aaeb commit 39e00ab

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

lib/SQL/Translator/Parser/SQLite.pm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,7 @@ sub parse {
681681
size => $fdata->{'size'},
682682
default_value => $fdata->{'default'},
683683
is_auto_increment => $fdata->{'is_auto_inc'},
684+
($fdata->{'is_auto_inc'}? ( extra => { auto_increment_type => 'monotonic' } ) : ()),
684685
is_nullable => $fdata->{'is_nullable'},
685686
comments => $fdata->{'comments'},
686687
) or die $table->error;

t/23json.t

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ my $json = from_json(<<JSON);
109109
"field comment 2"
110110
],
111111
"data_type" : "INTEGER",
112+
"extra" : {
113+
"auto_increment_type" : "monotonic"
114+
},
112115
"default_value" : null,
113116
"is_auto_increment" : 1,
114117
"is_nullable" : 0,

t/24yaml.t

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ schema:
100100
order: 1
101101
size:
102102
- 0
103+
extra:
104+
auto_increment_type: monotonic
103105
weight:
104106
data_type: double
105107
default_value: ~

0 commit comments

Comments
 (0)