CREATE OR REPLACE TABLE `vn`.`entryDms` (
  `entryFk` int(11) NOT NULL,
  `dmsFk` int(11) NOT NULL,
  `editorFk` int(10) unsigned DEFAULT NULL,
  PRIMARY KEY (`entryFk`,`dmsFk`),
  KEY `gestdoc_id` (`dmsFk`),
  KEY `entryDms_editor` (`editorFk`),
  CONSTRAINT `entryDms_dms` FOREIGN KEY (`dmsFk`) REFERENCES `dms` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `entryDms_editor` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`),
  CONSTRAINT `entryDms_entry` FOREIGN KEY (`entryFk`) REFERENCES `entry` (`id`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
    VALUES
        ('EntryDms', '*', '*', 'ALLOW', 'ROLE', 'employee');
