我有一张桌子,如下:
CREATE TABLE IF NOT EXISTS "matches" ("id" integer not null primary key autoincrement, "score_home" integer null, "score_away" integer null, "home" integer not null, "away" integer not null, "tournament_phase_id" integer not null, "valid_home" tinyint(1) not null default '0', "valid_away" tinyint(1) not null default '0', "kickoff" datetime null, "created_at" datetime null, "updated_at" datetime null, foreign key("home") references "users"("id"), foreign key("away") references "users"("id"), foreign key("tournament_phase_id") references "phase_tournament"("id") on delete cascade);
我通过修补添加了以下触发器:
DB::statement('CREATE TRIGGER update_match_validation UPDATE OF score_home, score_away ON matches BEGIN UPDATE matches SET valid_home = false, valid_away = false; END;');
该语句运行没有问题,我检查了数据库并创建了触发器。但是,当更新触发器上指示的指定列时,通过修补程序,laravel会抛出此错误:
Illuminate/Database/QueryException with message 'SQLSTATE[HY000]: General error: 1 no such column: false (SQL: update "matches" set "score_home" = 3, "updated_at" = 2019-11-28 20:01:40 where "id" = 9)'
奇怪的是,当我通过 sqlite 控制台更新 score_home 列时,触发器的执行成功,该做什么这应该。因此,我相信这一定是一个laravel问题。
我尝试使用:0,`0`,`false`,而不是 false ,但是它总是抛出相同的错误。