Laravel 迁移 - 在表中添加检查约束
2022-08-30 17:40:52
我想在Laravel Migration中创建一个这样的表-
CREATE TABLE Payroll
(
ID int PRIMARY KEY,
PositionID INT,
Salary decimal(9,2)
CHECK (Salary < 150000.00)
);
我所做的是——
Schema::create('Payroll', function (Blueprint $table)
{
$table->increments('id');
$table->integer('PositionID ');
$table->decimal('Salary',9,2);
//$table->timestamps();
});
但我不能创造这个 -
CHECK (Salary < 150000.00)
谁能告诉,如何在Laravel Migration中实现这些限制?CHECK