I am using laravel to add a column place into the user table. I created a new migration with a name 2017_05_18_025207_add_username_field_to_users_table .. and modified it describing the schema and all in up() and down(). However when i tried to migrate it using PHP artisan migrate . Its not reflected in the database.
class AddUsernameFieldToUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function(Blueprint $table)
{
$table->string('place');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function(Blueprint $table)
{
$table->dropColumn('place');
});
}
}
this code is what i wrote in the new migration .
You need to run composer du
command to register migration class and only then run php artisan migrate
command.
$table->string('place',255);
Run composer dump-autoload and run migration.