USE `vn2008`;

ALTER TABLE vn2008.department ADD `depth` int DEFAULT 0 NOT NULL;
ALTER TABLE vn2008.department ADD sons int DEFAULT 0 NOT NULL;

USE `vn`;

CREATE
OR REPLACE
VIEW `vn`.`department` AS select
    `b`.`department_id` AS `id`,
    `b`.`name` AS `name`,
    `b`.`father_id` AS `fatherFk`,
    `b`.`production` AS `isProduction`,
    `b`.`lft` AS `lft`,
    `b`.`rgt` AS `rgt`,
    `b`.`isSelected` AS `isSelected`,
    `b`.`depth` AS `depth`,
    `b`.`sons` AS `sons`
from
    `vn2008`.`department` `b`;