How to add decimal column to existing table in Laravel 5.3 migration
You're trying to use ->addColumn()
which isn't quite the right syntax.
Create a new migration, php artisan make:migrate add_cost_column_to_mileages
.
Then inside your migration, you want it to look like this for up:
Schema::table('mileages', function (Blueprint $table) {
$table->decimal('cost', 5,2); //Substitute 5,2 for your desired precision
});
And this for down:
Schema::table('mileages', function (Blueprint $table) {
$table->dropColumn('cost');
});
This is from the docs here, although they don't make it explicitly clear.