- Paul Harrington <phrrngtn@users.sourceforge.net>
- Peter Rabbitson <ribasushi@cpan.org>
- Robert Bohne <rbo@cpan.org>
-- Rafael Porres Molina <rporres@qindel.com>
- Ross Smith II <rossta@users.sf.net>
- Ryan D Johnson <ryan@innerfence.com>
- Salvatore Bonaccorso <carnil@cpan.org>
Changes for SQL::Translator
+ * Revert "Fix AUTOINCREMENT in SQLite"
+
0.11017 2013-10-30
* Apply quotes to fix tables that are reserved words, DBI::SQLServer (Jonathan C. Otsuka)
sub field {
my ($self, $field) = @_;
+
return join ' ',
$self->field_comments($field),
$self->field_name($field),
( $self->_ipk($field)
- ? $field->is_auto_increment
- ? ( 'INTEGER PRIMARY KEY AUTOINCREMENT' )
- : ( 'INTEGER PRIMARY KEY' )
+ ? ( 'INTEGER PRIMARY KEY' )
: ( $self->field_type($field) )
),
$self->field_nullable($field),
ALTER TABLE new_name ADD COLUMN new_field int;
CREATE TEMPORARY TABLE person_temp_alter (
- person_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ person_id INTEGER PRIMARY KEY NOT NULL,
name varchar(20) NOT NULL,
age int(11) DEFAULT 18,
weight double(11,2),
DROP TABLE person;
CREATE TABLE person (
- person_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ person_id INTEGER PRIMARY KEY NOT NULL,
name varchar(20) NOT NULL,
age int(11) DEFAULT 18,
weight double(11,2),
DROP TABLE "Basic";
CREATE TABLE "Basic" (
- "id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ "id" INTEGER PRIMARY KEY NOT NULL,
"title" varchar(100) NOT NULL DEFAULT 'hello',
"description" text DEFAULT '',
"email" varchar(500),
DROP TABLE "Another";
CREATE TABLE "Another" (
- "id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ "id" INTEGER PRIMARY KEY NOT NULL,
"num" numeric(10,2)
);
'BEGIN TRANSACTION',
q<DROP TABLE "Basic">,
q<CREATE TABLE "Basic" (
- "id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ "id" INTEGER PRIMARY KEY NOT NULL,
"title" varchar(100) NOT NULL DEFAULT 'hello',
"description" text DEFAULT '',
"email" varchar(500),
q<CREATE UNIQUE INDEX "very_long_index_name_on_title_field_which_should_be_truncated_for_various_rdbms" ON "Basic" ("title")>,
q<DROP TABLE "Another">,
q<CREATE TABLE "Another" (
- "id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ "id" INTEGER PRIMARY KEY NOT NULL,
"num" numeric(10,2)
)>,
q<DROP VIEW IF EXISTS "email_list">,
'COMMIT',
], 'SQLite translate in list context matches');
+
+
is_deeply($result, $expected, 'correctly unquoted excempted DEFAULTs');
}
-{
- my $table = SQL::Translator::Schema::Table->new(
- name => 'foo_auto_increment',
- );
- $table->add_field(
- name => 'id',
- data_type => 'integer',
- is_nullable => 0,
- is_auto_increment => 1,
- );
- $table->primary_key('id');
- my $expected = [ qq<CREATE TABLE "foo_auto_increment" (
- "id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
-)>];
- my $result = [SQL::Translator::Producer::SQLite::create_table($table, { no_comments => 1 })];
- is_deeply($result, $expected, 'correctly built table with autoincrement on primary key');
-}
-
-{
- my $table = SQL::Translator::Schema::Table->new(
- name => 'foo_no_auto_increment',
- );
- $table->add_field(
- name => 'id',
- data_type => 'integer',
- is_nullable => 0,
- is_auto_increment => 0,
- );
- $table->primary_key('id');
- my $expected = [ qq<CREATE TABLE "foo_no_auto_increment" (
- "id" INTEGER PRIMARY KEY NOT NULL
-)>];
- my $result = [SQL::Translator::Producer::SQLite::create_table($table, { no_comments => 1 })];
- is_deeply($result, $expected, 'correctly built table without autoincrement on primary key');
-}
-
done_testing;