salix/db/changes/230401/00-supplierIsVies.sql

17 lines
671 B
MySQL
Raw Normal View History

2022-11-18 08:21:21 +00:00
ALTER TABLE `vn`.`supplier` ADD `isVies` tinyint(4) DEFAULT 0 NOT NULL;
2022-11-21 07:11:01 +00:00
UPDATE `vn`.`supplier` s
JOIN vn.country c ON c.id = s.countryFk
SET s.nif = MID(s.nif, 3, LENGTH(s.nif)-1), s.isVies = TRUE
WHERE s.nif <> TRIM(IF(c.code = LEFT(s.nif, 2), MID(s.nif, 3, LENGTH(s.nif)-1), s.nif));
INSERT IGNORE INTO `vn`.`chat`
(senderFk, recipient, checkUserStatus, message, status, attempts)
VALUES(19294, '#informatica-cau', 0, '
```
UPDATE `vn`.`supplier` s
JOIN vn.country c ON c.id = s.countryFk
SET s.nif = MID(s.nif, 3, LENGTH(s.nif)-1), s.isVies = TRUE
WHERE s.nif <> TRIM(IF(c.code = LEFT(s.nif, 2), MID(s.nif, 3, LENGTH(s.nif)-1), s.nif));
```', 0, 0);