Reputation: 8695
I am following Dayle Rees's tutorial on migrations in Laravel 4. (And please see the link to understand my question). I am attempting to make some migration files using Artisan. I am at the paragraph beginning "We simply run...", followed by the example Artisan command:
php artisan migrate:make create_users --create --table=users
...followed by the resultant code (snippet):
public function up()
{
Schema::create('users', function(Blueprint $table)
{
$table->increments('id');
$table->timestamps();
});
}
But when I run the same artisan command, I don't get that. I get this instead:
public function up()
{
Schema::table('users', function(Blueprint $table)
{
//
});
}
Why?
Perhaps this is the result of a slightly later version of Laravel than Mr Rees was using for that tutorial, but the most annoying/puzzling thing is that the artisan command --create
doesn't seem to work properly, ie. it is outputting
Schema::table()
instead of
Schema::create()
Upvotes: 3
Views: 5131
Reputation: 8695
OK, for anyone reading this, I've found the answer. I think perhaps this is a mistake in Dayle Rees's tutorial. Following the docs, the artisan command should be
php artisan migrate:make create_users_table --create=users
So the moral of the story is that when the migration is for creating a table, the relevant command should be
php artisan migrate:make class_name --create=table_name
When modifying, the command is
php artisan migrate:make class_name --table=table_name
Upvotes: 14