[DBIx-Class-Devel] [sql-translator] Backward-compatible sqlite autoincrement (#47)
Dagfinn Ilmari Mannsåker
notifications at github.com
Wed Jan 7 13:45:24 GMT 2015
> @@ -165,6 +165,24 @@ $SQL::Translator::Producer::SQLite::NO_QUOTES = 0;
> }
>
> {
> + my $table = SQL::Translator::Schema::Table->new(
> + name => 'some_table',
> + );
> + $table->add_field(
> + name => 'id',
> + data_type => 'integer',
> + is_auto_increment => 1,
> + is_nullable => 0,
> + extra => {
> + auto_increment_method => 'sequence',
> + },
> + );
> + my $expected = [ qq<CREATE TABLE "some_table" (\n "id" integer AUTOINCREMENT NOT NULL\n)>];
This is not actually valid in SQLite, `AUTOINCREMENT` can only be used immediately after `INTEGER PRIMARY KEY`, so `field_autoinc()` should be checking `$self->_ipk($field)` as well as `$field->is_auto_increment` and `auto_increment_method`.
---
Reply to this email directly or view it on GitHub:
https://github.com/dbsrgits/sql-translator/pull/47/files#r22586062
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scsys.co.uk/pipermail/dbix-class-devel/attachments/20150107/da85e339/attachment.htm>
More information about the DBIx-Class-Devel
mailing list