salix/db/changes/234201/00-supplierAccountCheckLeng...

7 lines
371 B
SQL

UPDATE `vn`.`supplier`
SET account = LPAD(id,10,'0')
WHERE account IS NULL;
ALTER TABLE `vn`.`supplier` ADD CONSTRAINT supplierAccountTooShort CHECK (LENGTH(account) = 10);
ALTER TABLE `vn`.`supplier` MODIFY COLUMN account varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT 4100000000 NOT NULL COMMENT 'Default accounting code for suppliers.';