I din CreateUserTable
migrationsfil i stedet for Schema::table
du skal bruge Schema::create
.
Schema::table
bruges til at ændre en eksisterende tabel og Schema::create
bruges til at oprette en ny tabel.
Tjek dokumentationen:
- http://laravel.com/docs/schema#creating- og-slippe-borde
- http://laravel.com/docs/schema#adding-columns
Så din brugermigrering vil være:
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUserTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('user', function(Blueprint $table) {
{
$table->increments("id",true);
$table->string("username")->nullable()->default(null);
$table->string("password")->nullable()->default(null);
$table->string("email")->nullable()->default(null);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists("user");
}
}