вот мой сценарий миграции
Schema::create('orders', function (Blueprint $table) {
.
.
.
$table->decimal('coupon_discount')->default(0);
$table->decimal('delivery_charge')->default(0);
$table->decimal('sub_total')->default(0);
$table->decimal('total')->storedAs('(sub_total + delivery_charge) - coupon_discount');
$table->decimal('paid')->default(0);
$table->decimal('due')->storedAs('total - paid');
$table->longText('note')->nullable();
.
.
.
$table->timestamps();
});
мне нужно создать генерируемых столбцов для итоговых и ожидаемых столбцов.
, но при попытке запустить файл миграции было показано исключение
Исключение:
Подсветка \ База данных \ QueryException: SQLSTATE [42000]: синтаксическая ошибка или доступнарушение: 1064 У вас есть ошибка в вашем синтаксисе SQL;проверьте руководство, соответствующее вашей версии сервера MariaDB, на предмет правильного синтаксиса для использования рядом с 'сохранено, paid
десятичное число (8, 2), не равно нулю по умолчанию' 0 ', due
десятичное число (8, 2) как (всего' встрока 1 (SQL:
create table orders (
id int unsigned not null auto_increment primary key,
user_id int unsigned null,
area_id int unsigned not null,
location_id int unsigned not null,
delivery_add ress longtext not null,
delivery_address_id int unsigned null,
mobile varchar(191) not null,
email varchar(191) null,
coupon_id int unsigned null,
coupon_discount decimal(8, 2) not null default '0',
delivery_charge decimal(8, 2) not null default '0 ',
sub_total decimal(8, 2) not null default '0',
total decimal(8,
2) as ((sub_total + delivery_charge) - coupon_discount) stored,
paid decimal(8, 2) not null default '0',
due decimal(8,
2) as (total - paid) stored,
note longtext null,
order_type tin yint not null,
delivery_type tinyint not null,
status smallint not null default '0',
payment_method tinyint not null,
payment_channel smallint null,
payment_status tinyint not null default '0',
created_at timestamp null,
updated_at timestamp null
) default character set utf8mb4 collate 'utf8mb4_unicode_ci'
)
Примечание: у меня mysql Ver 15.1 Distrib 10.1.35-MariaDB, для Win32
что я пропустил?