-- -----------------------------------------------------
-- Table nodeRootT
-- -----------------------------------------------------
-- DROP TABLE IF EXISTS nodeRootT ;

CREATE TABLE IF NOT EXISTS nodeRootT (
  id INT UNSIGNED NOT NULL,
  isRoot ENUM('y') NOT NULL DEFAULT 'y',
  PRIMARY KEY (id),
  CONSTRAINT fk_nodeRootT_nodeT1
    FOREIGN KEY (id)
    REFERENCES nodeT (id)
    ON DELETE CASCADE
    ON UPDATE CASCADE)
ENGINE = InnoDB;


-- nodeRootT data

insert nodeRootT(id, isRoot)
select n.id, 'y'
from nodeT n
where n.isRoot = 'y';


-- delete nodeT.isRoot

alter table nodeT drop isRoot;


