CREATE TABLE IF NOT EXISTS sdm_krs_a.`Bemyndigelse` (
  `BemyndigelsePID` bigint(15) NOT NULL AUTO_INCREMENT,
  `kode` varchar(100) NOT NULL,
  `bemyndigende_cpr` varchar(10) NOT NULL,
  `bemyndigede_cpr` varchar(10) NOT NULL,
  `bemyndigede_cvr` varchar(8) NULL,
  `system` varchar(100) NOT NULL,
  `arbejdsfunktion` varchar(100) NOT NULL,
  `rettighed` varchar(100) NOT NULL,
  `status` varchar(100) NOT NULL,
  `godkendelses_dato` varchar(35) NULL,
  `oprettelses_dato` varchar(35) NULL,
  `modificeret_dato` varchar(35) NULL,
  `gyldig_fra_dato` varchar(35) NULL,
  `gyldig_til_dato` varchar(35) NULL,
  `ValidFrom` datetime NOT NULL,
  `ValidTo` datetime NOT NULL,
  `LastReplicated` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`BemyndigelsePID`),
  UNIQUE KEY `kodeValidFrom` (`kode`,`ValidFrom`),
  KEY `idxBemyndigendeCpr` (`bemyndigende_cpr`),
  KEY `idxBemyndigedeCpr` (`bemyndigede_cpr`),
  KEY `idxBemValidToFrom` (`ValidTo`,`ValidFrom`)
) ENGINE=InnoDB AUTO_INCREMENT=31510 DEFAULT CHARSET=utf8 ;
