Cakephp3 - migration : Add new table with primary key problem


Hi there, I tried to add new table named ‘allvisitor’ with auto increment ID as primary key…but FAILED

public function change()
                ->addColumn('id', 'integer',
                        'autoIncrement' => true,
                        'limit' => 10,

When I ran migrate command

$ bin/cake migrations migrate -t 20170417083919

Welcome to CakePHP v3.3.16 Console
App : src
Path: /var/www/html/AYAM/ayam_v4_site/src/
PHP : 7.1.4
using migration path /var/www/html/AYAM/ayam_v4_site/config/Migrations
using seed path /var/www/html/AYAM/ayam_v4_site/config/Seeds
using environment default
using adapter mysql
using database ayamDB_v4

 == 20170417083919 AyamVersion402rev1: migrating
Exception: SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'id' in [/var/www/html/AYAM/ayam_v4_site/vendor/robmorgan/phinx/src/Phinx/Db/Adapter/PdoAdapter.php, line 338]


The error message says that you already have the id column in your table.


Phinx automatically creates an auto-incrementing primary key column called id for every table