2015-05-19 22 views
6

starałem się utworzyć tabelę mającą jako domyślnej wartości całkowitej kod wygląda następująco:laravel 5 Migracja, Nieprawidłowa wartość domyślna, gdy całkowita

Schema::create('gsd_proyecto', function($table) { 
     $table->increments('id'); 
     $table->string('nombre', 80)->unique(); 
     $table->string('descripcion', 250)->nullable(); 
     $table->date('fechaInicio')->nullable(); 
     $table->date('fechaFin')->nullable(); 
     $table->integer('estado', 1)->default(0); 
     $table->string('ultimoModifico', 35)->nullable(); 
     $table->timestamps(); 
    }); 

Ale gdy uruchomię migrację I m uzyskiwanie następny błąd:

Next exception 'Illuminate\Database\QueryException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for 'estado' 

Sprawdzałem co jest SQL stworzony przez laravel i znalazłem kolejny

create table `gsd_proyecto` (
`id` int unsigned not null auto_increment primary key, 
`nombre` varchar(80) not null, 
`descripcion` varchar(250) null, 
`fechaInicio` date null, 
`fechaFin` date null, 
`estado` int not null default '0' auto_increment primary key, 
`ultimoModifico` varchar(35) null, 
`created_at` timestamp default 0 not null, 
`updated_at` timestamp default 0 not null 
) 

Jak widać, laravel próbuje ustawić pole Estado o wartości Char („0”), a także jako autoincrement klucz podstawowy

Każda pomoc będzie bardzo doceniane

Odpowiedz