In my event I have :
UPDATE Xdb.shop_product_m2m as m2m
SET m2m.expired=1 WHERE m2m.expires <= now();
And I tried this in the update trigger for the 'shop_product_m2m' table as :
SET NEW.modified = NOW();
IF NEW.expired =1 OR NEW.expired = "1" THEN
SET NEW.expired = 1;
ELSE
SET NEW.expired = 0;
SET NEW.expires =ADDDATE(NEW.modified, INTERVAL 15 DAY);
But the test in the line 'IF NEW.expired =1 OR NEW.expired = "1" THEN' fails thoroughly.
WHY AM I FAILING IN THIS ?
Thanks in advance..
EDIT : DDL of table 'shop_product_m2m' for added information of replies
create table if not exists Xdb.shop_product_m2m(
id int NOT NULL PRIMARY KEY AUTO_INCREMENT,
created datetime NOT NULL,
modified datetime NOT NULL,
expires datetime NOT NULL,
shop int NOT NULL,
product int NOT NULL,
price decimal(13,2),
instock boolean NOT NULL DEFAULT 1,
expired boolean NOT NULL DEFAULT 0,
burgainable boolean NOT NULL DEFAULT 1,
FOREIGN KEY (shop) REFERENCES shop(id) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (product) REFERENCES product(id) ON DELETE CASCADE ON UPDATE CASCADE
);