Reputation: 8588
I have created an run the following migration within my brand new Laravel project:
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUsersTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function(Blueprint $table)
{
$table->increments('id');
$table->string('name', 255);
$table->string('email', 255);
$table->integer('user_level');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('users');
}
}
I would have expected it to create a users
table with name, email, etc., but what I ended up with was a migration
table. What have I done wrong?
Upvotes: 0
Views: 147
Reputation: 372
Try this
Schema::create('users', function(Blueprint $table){
table->increments('id');
$table->string('name', 255);
$table->string('email', 255);
$table->integer('user_level');
$table->timestamps();
});
The migration
table is used by laravel to keep track of the migrations and rollbacks you have done.
Upvotes: 1