Sunday, 15 July 2012

php - Laravel 4 - Artisan error SQLSTATE[42000] -



php - Laravel 4 - Artisan error SQLSTATE[42000] -

i trying create new migration users table, have next schema:

schema::create('users', function($t) { $t->increments('id'); $t->string('username', 16); $t->string('password', 64); $t->integer('role', 64); $t->timestamps(); });

when seek run php artisan migrate terminal, next error:

[exception] sqlstate[42000]: syntax error or access violation: 1075 wrong table definition; there can 1 auto column , must defined key (sql: create table users (id int unsigne d not null auto_increment primary key, username varchar(16) not null, password varchar(64) no t null, role int not null auto_increment primary key, created_at timestamp default 0 not null , updated_at timestamp default 0 not null)) (bindings: array ( ))

the error has 'role' field, when removed seems run fine.

thanks in advance help or insight.

second parameter integer $autoincrement flag.

https://github.com/laravel/framework/blob/330d11ba8cd3d6c0a54a1125943526b126147b5f/src/illuminate/database/schema/blueprint.php#l443

php laravel

No comments:

Post a Comment