Skip to content

SQLiteAdapter adds autoincrement to integer column when changing primary key #2364

@MasterOdin

Description

@MasterOdin

If I do:

        $this->table('foo')
            ->addColumn('id_2', 'integer')
            ->create();

        $this->table('foo')
            ->changePrimaryKey('id_2')
            ->update();

After the create I'll have:

CREATE TABLE `foo` (`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, `id_2` INTEGER NULL);

and after the update I'll have:

CREATE TABLE IF NOT EXISTS "foo" (`id` INTEGER NOT NULL, `id_2` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT);

where even though didn't specify it, id_2 now has AUTOINCREMENT because it's an integer column. None of the other adapters does this, and it doesn't make sense that sqlite does either.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions