Я попытался выполнить 3 кода в проекте Laravel 5.3, чтобы добавить новый десятичный столбец в существующую таблицу. Но каждый раз он дает такую же ошибку.Как добавить десятичный столбец в существующую таблицу в Laravel 5.3 migration
Schema::table('mileages', function (Blueprint $table) {
$table->addColumn('decimal', 'cost');
});
и
Schema::table('mileages', function (Blueprint $table) {
$table->addColumn('decimal', 'cost', ['default'=>0]);
});
и
Schema::table('mileages', function (Blueprint $table) {
$table->addColumn('decimal', 'cost', ['default'=>'0,0']);
});
Ошибка:
[Illuminate\Database\QueryException]
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that
corresponds to your MariaDB server version for the right syntax to use near ') not null' at line 1 (SQL: alter table `mileages` add `cost` decimal (,) not null)
я упускаю что-то?
Да, это работает. Спасибо!. Также '$ table-> addColumn ('decimal', 'cost', ['default' => 0, 'total' => 8, 'places' => 2]);' работает. – Eranda