-- http://www.phpmyadmin.net
--

START TRANSACTION;



--
-- Database: `elela_tbl`
--
CREATE DATABASE IF NOT EXISTS `elela_tbl` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
USE `elela_tbl`;

-- --------------------------------------------------------

--
-- Table structure for table `adr`
--

CREATE TABLE IF NOT EXISTS `adr` (
`ID` int(11) NOT NULL,
  `ID_ID` int(11) DEFAULT NULL,
  `Foto_ID` int(11) DEFAULT NULL,
  `Bezeichnung` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `Firma` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Strasse` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `PLZ` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Ort` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Land` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Name` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Telefon` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Telefon2` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Mobil` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Fax` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `EMail` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `EMail2` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Skype` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Facebook` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Internet` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL,
  `KundNr` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Login` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Passwort` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `WLanSSID` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `WLanPasswort` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `UsSTID` varchar(25) COLLATE utf8_unicode_ci DEFAULT NULL,
  `GebDatum` date DEFAULT NULL,
  `Bank` varchar(40) COLLATE utf8_unicode_ci DEFAULT NULL,
  `BLZ` varchar(40) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Konto` varchar(40) COLLATE utf8_unicode_ci DEFAULT NULL,
  `SWIFT` varchar(40) COLLATE utf8_unicode_ci DEFAULT NULL,
  `IBAN` varchar(40) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Lieferant` int(11) DEFAULT NULL,
  `Hersteller` int(11) DEFAULT NULL,
  `Kunde` int(11) DEFAULT NULL,
  `Projekt` int(11) DEFAULT NULL,
  `Privat` int(11) DEFAULT NULL,
  `Gesperrt` int(11) DEFAULT NULL,
  `OptZ` int(11) DEFAULT NULL,
  `OptQ` int(11) DEFAULT NULL,
  `Rabatt` double DEFAULT NULL,
  `Bewertung` int(11) DEFAULT NULL,
  `BewDatum` date DEFAULT NULL,
  `UpdateDatum` date DEFAULT NULL,
  `Handbuch` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Info` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Bemerkung` text COLLATE utf8_unicode_ci,
  `AendDatum` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `bauteil`
--

CREATE TABLE IF NOT EXISTS `bauteil` (
`ID` int(11) NOT NULL,
  `tree_typ_ID` int(11) NOT NULL,
  `Foto_ID` int(11) DEFAULT NULL,
  `Bezeichnung` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `Beschreibung` text COLLATE utf8_unicode_ci,
  `Handbuch` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Library` varchar(70) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Kennz` int(11) DEFAULT NULL,
  `Info` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `AendDatum` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ;

-- --------------------------------------------------------

--
-- Table structure for table `bauteiladr`
--

CREATE TABLE IF NOT EXISTS `bauteiladr` (
`ID` int(11) NOT NULL,
  `Bauteil_ID` int(11) NOT NULL,
  `Adr_ID` int(11) NOT NULL,
  `BauteilLager_ID` int(11) DEFAULT NULL,
  `Foto_ID` int(11) DEFAULT NULL,
  `BestellNr` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `EPreis` double DEFAULT NULL,
  `Rabatt` double DEFAULT NULL,
  `EPMenge` int(11) DEFAULT NULL,
  `VPEMenge` double DEFAULT NULL,
  `DivMenge` double DEFAULT NULL,
  `Bemerkung` text COLLATE utf8_unicode_ci,
  `AendDatum` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `bauteilbewegung`
--

CREATE TABLE IF NOT EXISTS `bauteilbewegung` (
`ID` int(11) NOT NULL,
  `Bauteil_ID` int(11) NOT NULL,
  `BauteilLager_ID` int(11) NOT NULL,
  `Bestellen_ID` int(11) DEFAULT NULL,
  `Projekt_ID` int(11) DEFAULT NULL,
  `ProjektPos_ID` int(11) DEFAULT NULL,
  `UserName` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `ComputerName` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Grund` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL,
  `PMMenge` double DEFAULT NULL,
  `Menge` double DEFAULT NULL,
  `Datum` datetime DEFAULT NULL,
  `AendDatum` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `bauteillager`
--

CREATE TABLE IF NOT EXISTS `bauteillager` (
`ID` int(11) NOT NULL,
  `Bauteil_ID` int(11) NOT NULL,
  `Gehause_ID` int(11) DEFAULT NULL,
  `Kiste_ID` int(11) DEFAULT NULL,
  `Adr_ID` int(11) DEFAULT NULL,
  `Foto_ID` int(11) DEFAULT NULL,
  `Bezeichnung` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
  `ArtikelNr` varchar(40) COLLATE utf8_unicode_ci DEFAULT NULL,
  `ArtikelNr2` varchar(40) COLLATE utf8_unicode_ci DEFAULT NULL,
  `SMD` int(11) NOT NULL DEFAULT '0',
  `SMD_Text` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Menge` double DEFAULT NULL,
  `MengeV` double DEFAULT NULL,
  `MengeMin` double DEFAULT NULL,
  `Einheit` varchar(40) COLLATE utf8_unicode_ci DEFAULT NULL,
  `EPreis` double DEFAULT NULL,
  `VPreis` double DEFAULT NULL,
  `Haltbar` date DEFAULT NULL,
  `Lagernr` varchar(40) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Art` int(11) DEFAULT NULL,
  `BWare` int(11) DEFAULT NULL,
  `RoHS` int(11) DEFAULT NULL,
  `Bemerkung` text COLLATE utf8_unicode_ci,
  `Handbuch` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Library` varchar(70) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Kennz` int(11) DEFAULT NULL,
  `Store` int(11) DEFAULT NULL,
  `StoreMenge` double DEFAULT NULL,
  `Info` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Gewicht` double DEFAULT NULL,
  `Barcode` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL,
  `AendDatum` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `bestellen`
--

CREATE TABLE IF NOT EXISTS `bestellen` (
`ID` int(11) NOT NULL,
  `Bauteil_ID` int(11) DEFAULT NULL,
  `BauteilLager_ID` int(11) DEFAULT NULL,
  `Foto_ID` int(11) DEFAULT NULL,
  `Projekt_ID` int(11) DEFAULT NULL,
  `Bezeichnung` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Auftrag` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Menge` double DEFAULT NULL,
  `Status` int(11) DEFAULT NULL,
  `SDatum` date DEFAULT NULL,
  `Termin1` date DEFAULT NULL,
  `Termin2` date DEFAULT NULL,
  `Archiv` int(11) DEFAULT NULL,
  `Bemerkung` text COLLATE utf8_unicode_ci,
  `Handbuch` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Info` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `UseLief12` int(11) DEFAULT NULL,
  `Lief_MengeVPE` double DEFAULT NULL,
  `Lief_MengeVPESum` double DEFAULT NULL,
  `Lager_MengeVPESum` double DEFAULT NULL,
  `Lief1_Adr_ID` int(11) DEFAULT NULL,
  `Lief1_BauteilAdr_ID` int(11) DEFAULT NULL,
  `Lief1_BestellNr` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Lief1_MengeVPE` double DEFAULT NULL,
  `Lief1_EPreis` double DEFAULT NULL,
  `Lief1_Rabatt` double DEFAULT NULL,
  `Lief1_GPreis` double DEFAULT NULL,
  `Lief2_Adr_ID` int(11) DEFAULT NULL,
  `Lief2_BauteilAdr_ID` int(11) DEFAULT NULL,
  `Lief2_BestellNr` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Lief2_MengeVPE` double DEFAULT NULL,
  `Lief2_EPreis` double DEFAULT NULL,
  `Lief2_Rabatt` double DEFAULT NULL,
  `Lief2_GPreis` double DEFAULT NULL,
  `Kennz` int(11) DEFAULT NULL,
  `Prio` int(11) DEFAULT NULL,
  `OptA` int(11) DEFAULT NULL,
  `OptB` int(11) DEFAULT NULL,
  `OptC` int(11) DEFAULT NULL,
  `AendDatum` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `doku`
--

CREATE TABLE IF NOT EXISTS `doku` (
`ID` int(11) NOT NULL,
  `ID_ID_Version` int(11) DEFAULT NULL,
  `Foto_ID` int(11) DEFAULT NULL,
  `Bauteil_ID` int(11) DEFAULT NULL,
  `BauteilLager_ID` int(11) DEFAULT NULL,
  `Bezeichnung` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `KurzBez` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Thema` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Status` int(11) DEFAULT NULL,
  `Datum` date DEFAULT NULL,
  `Version` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Revision` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Bearbeiter` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Handbuch` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL,
  `HandbuchPDF` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL,
  `DirZiel` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Bemerkung` text COLLATE utf8_unicode_ci,
  `Info` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Archiv` int(11) DEFAULT NULL,
  `Nr` int(11) DEFAULT NULL,
  `AutoNr` int(11) DEFAULT NULL,
  `Kennz` int(11) DEFAULT NULL,
  `OptA` int(11) DEFAULT NULL,
  `OptB` int(11) DEFAULT NULL,
  `OptC` int(11) DEFAULT NULL,
  `AendDatum` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `foto`
--

CREATE TABLE IF NOT EXISTS `foto` (
`ID` int(11) NOT NULL,
  `ID_ID` int(11) DEFAULT NULL,
  `Bezeichnung` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Tabelle` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL,
  `BildTyp` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
  `Bild` blob,
  `BildDatei` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `PosX0` int(11) DEFAULT NULL,
  `PosY0` int(11) DEFAULT NULL,
  `PosXFak` double DEFAULT NULL,
  `PosYFak` double DEFAULT NULL,
  `PosTop` int(11) DEFAULT NULL,
  `AendDatum` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `gehause`
--

CREATE TABLE IF NOT EXISTS `gehause` (
`ID` int(11) NOT NULL,
  `Foto_ID` int(11) DEFAULT NULL,
  `Bezeichnung` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `Typ` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Normbez` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Herstellerbez` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Library` varchar(70) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Pins` int(11) DEFAULT NULL,
  `Raster` double DEFAULT NULL,
  `Gewicht` double DEFAULT NULL,
  `Bemerkung` text COLLATE utf8_unicode_ci,
  `Handbuch` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Info` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `SMD` int(11) DEFAULT NULL,
  `AendDatum` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `historie`
--

CREATE TABLE IF NOT EXISTS `historie` (
`ID` int(11) NOT NULL,
  `Projekt_ID` int(11) DEFAULT NULL,
  `ProjektPos_ID` int(11) DEFAULT NULL,
  `Kosten_ID` int(11) DEFAULT NULL,
  `Foto_ID` int(11) DEFAULT NULL,
  `Adr_ID` int(11) DEFAULT NULL,
  `AdrK_ID` int(11) DEFAULT NULL,
  `Datum` date DEFAULT NULL,
  `Projekt` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Bezeichnung` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `Beschreibung` text COLLATE utf8_unicode_ci,
  `Version` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Status` int(11) DEFAULT NULL,
  `FStatus` int(11) DEFAULT NULL,
  `SNr` varchar(40) COLLATE utf8_unicode_ci DEFAULT NULL,
  `GNr` varchar(40) COLLATE utf8_unicode_ci DEFAULT NULL,
  `FDatum` date DEFAULT NULL,
  `FVersion` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Kennz` int(11) DEFAULT NULL,
  `Aufwand` double DEFAULT NULL,
  `Vorgehen` int(11) DEFAULT NULL,
  `Abrechnung` int(11) DEFAULT NULL,
  `GPreis` double DEFAULT NULL,
  `Handbuch` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Info` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `KundeBes` text COLLATE utf8_unicode_ci,
  `RepNr` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `RepFehler` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `RepBes` text COLLATE utf8_unicode_ci,
  `AendDatum` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `kiste`
--

CREATE TABLE IF NOT EXISTS `kiste` (
`ID` int(11) NOT NULL,
  `Foto_ID` int(11) DEFAULT NULL,
  `Bezeichnung` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `Nummer` int(11) DEFAULT NULL,
  `PosX` int(11) DEFAULT NULL,
  `PosY` int(11) DEFAULT NULL,
  `Lagerort` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Groesse` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Bemerkung` text COLLATE utf8_unicode_ci,
  `Handbuch` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Info` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Barcode` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL,
  `ParEtikett` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL,
  `AendDatum` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `kosten`
--

CREATE TABLE IF NOT EXISTS `kosten` (
`ID` int(11) NOT NULL,
  `Projekt_ID` int(11) DEFAULT NULL,
  `Adr_ID` int(11) DEFAULT NULL,
  `AdrK_ID` int(11) DEFAULT NULL,
  `Foto_ID` int(11) DEFAULT NULL,
  `Bezeichnung` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `Beschreibung` text COLLATE utf8_unicode_ci,
  `Status` int(11) DEFAULT NULL,
  `Auftrag` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Bestellnr` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Rabatt` double DEFAULT NULL,
  `GPreis` double DEFAULT NULL,
  `DAngebot` date DEFAULT NULL,
  `DGueltig` date DEFAULT NULL,
  `DLief` date DEFAULT NULL,
  `DAbnahme` date DEFAULT NULL,
  `Info` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `AendDatum` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `kostenpos`
--

CREATE TABLE IF NOT EXISTS `kostenpos` (
`ID` int(11) NOT NULL,
  `Projekt_ID` int(11) DEFAULT NULL,
  `Kosten_ID` int(11) NOT NULL,
  `ProjektPos_ID` int(11) DEFAULT NULL,
  `Bauteil_ID` int(11) DEFAULT NULL,
  `BauteilLager_ID` int(11) DEFAULT NULL,
  `Foto_ID` int(11) DEFAULT NULL,
  `Nr` int(11) DEFAULT NULL,
  `Bezeichnung` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `Beschreibung` text COLLATE utf8_unicode_ci,
  `Status` int(11) DEFAULT NULL,
  `Menge` double DEFAULT NULL,
  `VPreis` double DEFAULT NULL,
  `Rabatt` double DEFAULT NULL,
  `VPSum` double DEFAULT NULL,
  `ArtikelNr` varchar(40) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Barcode` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Termin` date DEFAULT NULL,
  `DLief` date DEFAULT NULL,
  `Info` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Art` int(11) DEFAULT NULL,
  `AendDatum` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `param`
--

CREATE TABLE IF NOT EXISTS `param` (
`ID` int(11) NOT NULL,
  `ParNr` int(11) DEFAULT NULL,
  `ParName` varchar(40) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Land` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
  `ValInt` int(11) DEFAULT NULL,
  `ValFloat` double DEFAULT NULL,
  `ValText` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL,
  `ValMemo` text COLLATE utf8_unicode_ci,
  `AendDatum` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=4 ;

-- --------------------------------------------------------

--
-- Table structure for table `projekt`
--

CREATE TABLE IF NOT EXISTS `projekt` (
`ID` int(11) NOT NULL,
  `ID_ID` int(11) DEFAULT NULL,
  `ID_ID_Version` int(11) DEFAULT NULL,
  `ProjektVersion_ID` int(11) DEFAULT NULL,
  `Foto_ID` int(11) DEFAULT NULL,
  `Bauteil_ID` int(11) DEFAULT NULL,
  `BauteilLager_ID` int(11) DEFAULT NULL,
  `Adr_ID` int(11) DEFAULT NULL,
  `Typ` int(11) DEFAULT NULL,
  `Bezeichnung` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `Beschreibung` text COLLATE utf8_unicode_ci,
  `Kennz` int(11) DEFAULT NULL,
  `MengeFertig` int(11) DEFAULT NULL,
  `MengeOffen` int(11) DEFAULT NULL,
  `VPreis` double DEFAULT NULL,
  `Termin` date DEFAULT NULL,
  `Handbuch` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Info` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `OptA` int(11) DEFAULT NULL,
  `OptB` int(11) DEFAULT NULL,
  `OptC` int(11) DEFAULT NULL,
  `Wartung` date DEFAULT NULL,
  `Intervall` varchar(40) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Auftrag` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `SNr` varchar(40) COLLATE utf8_unicode_ci DEFAULT NULL,
  `VersionTyp` int(11) DEFAULT NULL,
  `Variante` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL,
  `AendDatum` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `projektdoku`
--

CREATE TABLE IF NOT EXISTS `projektdoku` (
`ID` int(11) NOT NULL,
  `ID_ID_Version` int(11) DEFAULT NULL,
  `Projekt_ID` int(11) DEFAULT NULL,
  `ProjektVersion_ID` int(11) DEFAULT NULL,
  `Doku_ID` int(11) DEFAULT NULL,
  `Foto_ID` int(11) DEFAULT NULL,
  `Bauteil_ID` int(11) DEFAULT NULL,
  `BauteilLager_ID` int(11) DEFAULT NULL,
  `Bezeichnung` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `KurzBez` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Thema` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Status` int(11) DEFAULT NULL,
  `Datum` date DEFAULT NULL,
  `Version` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Revision` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Bearbeiter` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Handbuch` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL,
  `HandbuchPDF` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Bemerkung` text COLLATE utf8_unicode_ci,
  `Info` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `QuelleDoku` int(11) DEFAULT NULL,
  `Nr` int(11) DEFAULT NULL,
  `AutoNr` int(11) DEFAULT NULL,
  `Kennz` int(11) DEFAULT NULL,
  `OptA` int(11) DEFAULT NULL,
  `OptB` int(11) DEFAULT NULL,
  `OptC` int(11) DEFAULT NULL,
  `AendDatum` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `projektpos`
--

CREATE TABLE IF NOT EXISTS `projektpos` (
`ID` int(11) NOT NULL,
  `ID_ID_Version` int(11) DEFAULT NULL,
  `ProjektVersion_ID` int(11) DEFAULT NULL,
  `Projekt_ID` int(11) NOT NULL,
  `Bauteil_ID` int(11) DEFAULT NULL,
  `BauteilLager_ID` int(11) DEFAULT NULL,
  `Foto_ID` int(11) DEFAULT NULL,
  `Geloescht` int(11) DEFAULT NULL,
  `Bezeichnung` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
  `ArtikelNr` varchar(40) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Bemerkung` text COLLATE utf8_unicode_ci,
  `Symbol` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Wert` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Gehause` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Menge` double DEFAULT NULL,
  `EPreis` double DEFAULT NULL,
  `Rabatt` double DEFAULT NULL,
  `GPreis` double DEFAULT NULL,
  `Art` int(11) DEFAULT NULL,
  `Kennz` int(11) DEFAULT NULL,
  `Variante` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `PosX` double DEFAULT NULL,
  `PosY` double DEFAULT NULL,
  `PosZ` double DEFAULT NULL,
  `PosR` double DEFAULT NULL,
  `Top` int(11) DEFAULT NULL,
  `SMD` int(11) DEFAULT NULL,
  `Status` int(11) DEFAULT NULL,
  `Barcode` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL,
  `SNr` varchar(40) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Handbuch` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Info` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Druck` int(11) DEFAULT NULL,
  `AendDatum` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `projektversion`
--

CREATE TABLE IF NOT EXISTS `projektversion` (
`ID` int(11) NOT NULL,
  `ID_ID` int(11) DEFAULT NULL,
  `Foto_ID` int(11) DEFAULT NULL,
  `Projekt_ID` int(11) DEFAULT NULL,
  `Bauteil_ID` int(11) DEFAULT NULL,
  `BauteilLager_ID` int(11) DEFAULT NULL,
  `Datum` date DEFAULT NULL,
  `Version` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Revision` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Status` int(11) DEFAULT NULL,
  `Bezeichnung` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `Beschreibung` text COLLATE utf8_unicode_ci,
  `Bearbeiter` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Pruefer` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `PrueferD` date DEFAULT NULL,
  `Freigeber` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `FreigeberD` date DEFAULT NULL,
  `MengeFertig` double DEFAULT NULL,
  `MengeOffen` double DEFAULT NULL,
  `VPreis` double DEFAULT NULL,
  `Handbuch` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Info` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Auftrag` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Termin` date DEFAULT NULL,
  `SNr` varchar(40) COLLATE utf8_unicode_ci DEFAULT NULL,
  `ArtikelNr` varchar(40) COLLATE utf8_unicode_ci DEFAULT NULL,
  `ArtikelNr2` varchar(40) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Barcode` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL,
  `OptA` int(11) DEFAULT NULL,
  `OptB` int(11) DEFAULT NULL,
  `OptC` int(11) DEFAULT NULL,
  `Kennz` int(11) DEFAULT NULL,
  `AendDatum` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `storeteile`
--

CREATE TABLE IF NOT EXISTS `storeteile` (
`ID` int(11) NOT NULL,
  `StoreUser_ID` int(11) NOT NULL,
  `Status` int(11) DEFAULT NULL,
  `SucheBiete` int(11) DEFAULT NULL,
  `Bezeichnung` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
  `BezeichnungGL` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Gehause` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Beschreibung` text COLLATE utf8_unicode_ci,
  `Zustand` int(11) DEFAULT NULL,
  `Hersteller` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Menge` double DEFAULT NULL,
  `Preis` double DEFAULT NULL,
  `Foto` blob,
  `MengeMerken` double DEFAULT NULL,
  `Info` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `OptA` int(11) DEFAULT NULL,
  `OptB` int(11) DEFAULT NULL,
  `OptC` int(11) DEFAULT NULL,
  `Kennz` int(11) DEFAULT NULL,
  `AendDatum` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `storeuser`
--

CREATE TABLE IF NOT EXISTS `storeuser` (
`ID` int(11) NOT NULL,
  `UserName` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Location` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Profil` text COLLATE utf8_unicode_ci,
  `Gewerblich` int(11) DEFAULT NULL,
  `Status` int(11) DEFAULT NULL,
  `Info` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `OptA` int(11) DEFAULT NULL,
  `OptB` int(11) DEFAULT NULL,
  `OptC` int(11) DEFAULT NULL,
  `Kennz` int(11) DEFAULT NULL,
  `AendDatum` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `translate`
--

CREATE TABLE IF NOT EXISTS `translate` (
`ID` int(11) NOT NULL,
  `SWTyp` int(11) DEFAULT NULL,
  `BezName` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `Current` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL,
  `DE` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL,
  `DE_Waren` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL,
  `EN` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL,
  `ES` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL,
  `FR` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL,
  `IT` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL,
  `NL` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL,
  `PL` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL,
  `RU` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL,
  `AendDatum` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `tree_typ`
--

CREATE TABLE IF NOT EXISTS `tree_typ` (
`ID` int(11) NOT NULL,
  `ID_ID` int(11) DEFAULT NULL,
  `Foto_ID` int(11) DEFAULT NULL,
  `Bezeichnung` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `BarFormat` varchar(40) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Bemerkung` text COLLATE utf8_unicode_ci,
  `AendDatum` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=3 ;

-- --------------------------------------------------------

--
-- Table structure for table `wissen`
--

CREATE TABLE IF NOT EXISTS `wissen` (
`ID` int(11) NOT NULL,
  `Foto_ID` int(11) DEFAULT NULL,
  `Bezeichnung` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `Beschreibung` text COLLATE utf8_unicode_ci,
  `Bemerkung` text COLLATE utf8_unicode_ci,
  `Thema` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Status` int(11) DEFAULT NULL,
  `OptA` int(11) DEFAULT NULL,
  `OptB` int(11) DEFAULT NULL,
  `OptC` int(11) DEFAULT NULL,
  `Info` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Kennz` int(11) DEFAULT NULL,
  `Handbuch` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL,
  `AendDatum` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `adr`
--
ALTER TABLE `adr`
 ADD PRIMARY KEY (`ID`), ADD UNIQUE KEY `Adr_Bezeichnung_IX` (`ID_ID`,`Bezeichnung`), ADD KEY `adr_Foto_ID_IX` (`Foto_ID`), ADD KEY `ID_ID` (`ID_ID`);

--
-- Indexes for table `bauteil`
--
ALTER TABLE `bauteil`
 ADD PRIMARY KEY (`ID`), ADD UNIQUE KEY `bauteil_Bezeichnung_IX` (`Bezeichnung`), ADD KEY `bauteil_tree_typ_ID_IX` (`tree_typ_ID`), ADD KEY `Foto_ID` (`Foto_ID`);

--
-- Indexes for table `bauteiladr`
--
ALTER TABLE `bauteiladr`
 ADD PRIMARY KEY (`ID`), ADD KEY `bauteiladr_Bauteil_ID_IX` (`Bauteil_ID`), ADD KEY `bauteiladr_Adr_ID_IX` (`Adr_ID`), ADD KEY `bauteiladr_BauteilLager_ID_IX` (`BauteilLager_ID`), ADD KEY `bauteiladr_BestellNr_IX` (`BestellNr`), ADD KEY `Foto_ID` (`Foto_ID`);

--
-- Indexes for table `bauteilbewegung`
--
ALTER TABLE `bauteilbewegung`
 ADD PRIMARY KEY (`ID`), ADD KEY `bauteilbewegung_Bauteil_ID_IX` (`Bauteil_ID`), ADD KEY `bauteilbewegung_BauteilLager_ID_IX` (`BauteilLager_ID`), ADD KEY `Bestellen_ID` (`Bestellen_ID`), ADD KEY `Projekt_ID` (`Projekt_ID`), ADD KEY `ProjektPos_ID` (`ProjektPos_ID`);

--
-- Indexes for table `bauteillager`
--
ALTER TABLE `bauteillager`
 ADD PRIMARY KEY (`ID`), ADD KEY `bauteillager_Kiste_ID_IX` (`Kiste_ID`), ADD KEY `bauteillager_Gehause_ID_IX` (`Gehause_ID`), ADD KEY `bauteillager_Bauteil_ID_IX` (`Bauteil_ID`), ADD KEY `bauteillager_Adr_ID_IX` (`Adr_ID`), ADD KEY `bauteillager_SMD_Text_IX` (`SMD_Text`), ADD KEY `bauteillager_Lagernr_IX` (`Lagernr`), ADD KEY `bauteillager_Barcode_IX` (`Barcode`), ADD KEY `bauteillager_Bezeichnung_IX` (`Bezeichnung`), ADD KEY `Foto_ID` (`Foto_ID`);

--
-- Indexes for table `bestellen`
--
ALTER TABLE `bestellen`
 ADD PRIMARY KEY (`ID`), ADD KEY `bestellen_Lief1_Adr_ID_IX` (`Lief1_Adr_ID`), ADD KEY `bestellen_Lief2_Adr_ID_IX` (`Lief2_Adr_ID`), ADD KEY `bestellen_Archiv_IX` (`Archiv`), ADD KEY `bestellen_Auftrag_IX` (`Auftrag`), ADD KEY `Bauteil_ID` (`Bauteil_ID`), ADD KEY `BauteilLager_ID` (`BauteilLager_ID`), ADD KEY `Foto_ID` (`Foto_ID`), ADD KEY `Projekt_ID` (`Projekt_ID`), ADD KEY `Lief1_BauteilAdr_ID` (`Lief1_BauteilAdr_ID`), ADD KEY `Lief2_BauteilAdr_ID` (`Lief2_BauteilAdr_ID`);

--
-- Indexes for table `doku`
--
ALTER TABLE `doku`
 ADD PRIMARY KEY (`ID`), ADD KEY `ID_ID_Version` (`ID_ID_Version`), ADD KEY `Foto_ID` (`Foto_ID`), ADD KEY `Bauteil_ID` (`Bauteil_ID`), ADD KEY `BauteilLager_ID` (`BauteilLager_ID`);

--
-- Indexes for table `foto`
--
ALTER TABLE `foto`
 ADD PRIMARY KEY (`ID`), ADD KEY `ID_ID` (`ID_ID`);

--
-- Indexes for table `gehause`
--
ALTER TABLE `gehause`
 ADD PRIMARY KEY (`ID`), ADD KEY `Foto_ID` (`Foto_ID`);

--
-- Indexes for table `historie`
--
ALTER TABLE `historie`
 ADD PRIMARY KEY (`ID`), ADD KEY `Projekt_ID` (`Projekt_ID`), ADD KEY `ProjektPos_ID` (`ProjektPos_ID`), ADD KEY `Kosten_ID` (`Kosten_ID`), ADD KEY `Foto_ID` (`Foto_ID`), ADD KEY `Adr_ID` (`Adr_ID`), ADD KEY `AdrK_ID` (`AdrK_ID`);

--
-- Indexes for table `kiste`
--
ALTER TABLE `kiste`
 ADD PRIMARY KEY (`ID`), ADD KEY `Foto_ID` (`Foto_ID`);

--
-- Indexes for table `kosten`
--
ALTER TABLE `kosten`
 ADD PRIMARY KEY (`ID`), ADD UNIQUE KEY `kosten_Bezeichnung_IX` (`Projekt_ID`,`Bezeichnung`), ADD KEY `kosten_Projekt_ID_IX` (`Projekt_ID`), ADD KEY `kosten_Adr_ID_IX` (`Adr_ID`), ADD KEY `AdrK_ID` (`AdrK_ID`), ADD KEY `Foto_ID` (`Foto_ID`);

--
-- Indexes for table `kostenpos`
--
ALTER TABLE `kostenpos`
 ADD PRIMARY KEY (`ID`), ADD KEY `kostenpos_Projekt_ID_IX` (`Projekt_ID`), ADD KEY `kostenpos_Kosten_ID_IX` (`Kosten_ID`), ADD KEY `kostenpos_ProjektPos_ID_IX` (`ProjektPos_ID`), ADD KEY `kostenpos_Bauteil_ID_IX` (`Bauteil_ID`), ADD KEY `kostenpos_BauteilLager_ID_IX` (`BauteilLager_ID`), ADD KEY `Foto_ID` (`Foto_ID`);

--
-- Indexes for table `param`
--
ALTER TABLE `param`
 ADD PRIMARY KEY (`ID`), ADD KEY `param_ParNr_IX` (`ParNr`);

--
-- Indexes for table `projekt`
--
ALTER TABLE `projekt`
 ADD PRIMARY KEY (`ID`), ADD KEY `ID_ID` (`ID_ID`), ADD KEY `Foto_ID` (`Foto_ID`), ADD KEY `Bauteil_ID` (`Bauteil_ID`), ADD KEY `BauteilLager_ID` (`BauteilLager_ID`), ADD KEY `projekt_Bezeichnung_IX` (`Bezeichnung`), ADD KEY `ID_ID_Version` (`ID_ID_Version`), ADD KEY `ProjektVersion_ID` (`ProjektVersion_ID`), ADD KEY `Adr_ID` (`Adr_ID`);

--
-- Indexes for table `projektdoku`
--
ALTER TABLE `projektdoku`
 ADD PRIMARY KEY (`ID`), ADD KEY `ID_ID_Version` (`ID_ID_Version`), ADD KEY `Projekt_ID` (`Projekt_ID`), ADD KEY `ProjektVersion_ID` (`ProjektVersion_ID`), ADD KEY `Doku_ID` (`Doku_ID`), ADD KEY `Foto_ID` (`Foto_ID`), ADD KEY `Bauteil_ID` (`Bauteil_ID`), ADD KEY `BauteilLager_ID` (`BauteilLager_ID`);

--
-- Indexes for table `projektpos`
--
ALTER TABLE `projektpos`
 ADD PRIMARY KEY (`ID`), ADD KEY `projektpos_Projekt_ID_IX` (`Projekt_ID`), ADD KEY `ID_ID_Version` (`ID_ID_Version`), ADD KEY `ProjektVersion_ID` (`ProjektVersion_ID`), ADD KEY `Bauteil_ID` (`Bauteil_ID`), ADD KEY `BauteilLager_ID` (`BauteilLager_ID`), ADD KEY `Foto_ID` (`Foto_ID`);

--
-- Indexes for table `projektversion`
--
ALTER TABLE `projektversion`
 ADD PRIMARY KEY (`ID`), ADD UNIQUE KEY `Foto_ID` (`Foto_ID`), ADD UNIQUE KEY `Bauteil_ID` (`Bauteil_ID`), ADD UNIQUE KEY `BauteilLager_ID` (`BauteilLager_ID`), ADD KEY `projektversion_Projekt_ID_IX` (`Projekt_ID`), ADD KEY `ID_ID` (`ID_ID`);

--
-- Indexes for table `storeteile`
--
ALTER TABLE `storeteile`
 ADD PRIMARY KEY (`ID`), ADD KEY `StoreUser_ID` (`StoreUser_ID`);

--
-- Indexes for table `storeuser`
--
ALTER TABLE `storeuser`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `translate`
--
ALTER TABLE `translate`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `tree_typ`
--
ALTER TABLE `tree_typ`
 ADD PRIMARY KEY (`ID`), ADD KEY `tree_typ_ID_ID_IX` (`ID_ID`), ADD KEY `Foto_ID` (`Foto_ID`);

--
-- Indexes for table `wissen`
--
ALTER TABLE `wissen`
 ADD PRIMARY KEY (`ID`), ADD KEY `Foto_ID` (`Foto_ID`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `adr`
--
ALTER TABLE `adr`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `bauteil`
--
ALTER TABLE `bauteil`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `bauteiladr`
--
ALTER TABLE `bauteiladr`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `bauteilbewegung`
--
ALTER TABLE `bauteilbewegung`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `bauteillager`
--
ALTER TABLE `bauteillager`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `bestellen`
--
ALTER TABLE `bestellen`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `doku`
--
ALTER TABLE `doku`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `foto`
--
ALTER TABLE `foto`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `gehause`
--
ALTER TABLE `gehause`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `historie`
--
ALTER TABLE `historie`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `kiste`
--
ALTER TABLE `kiste`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `kosten`
--
ALTER TABLE `kosten`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `kostenpos`
--
ALTER TABLE `kostenpos`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `param`
--
ALTER TABLE `param`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `projekt`
--
ALTER TABLE `projekt`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `projektdoku`
--
ALTER TABLE `projektdoku`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `projektpos`
--
ALTER TABLE `projektpos`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `projektversion`
--
ALTER TABLE `projektversion`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `storeteile`
--
ALTER TABLE `storeteile`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `storeuser`
--
ALTER TABLE `storeuser`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `translate`
--
ALTER TABLE `translate`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `tree_typ`
--
ALTER TABLE `tree_typ`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `wissen`
--
ALTER TABLE `wissen`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- Constraints for dumped tables
--

--
-- Constraints for table `adr`
--
ALTER TABLE `adr`
ADD CONSTRAINT `adr_ibfk_1` FOREIGN KEY (`ID_ID`) REFERENCES `adr` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `adr_ibfk_2` FOREIGN KEY (`Foto_ID`) REFERENCES `foto` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Constraints for table `bauteil`
--
ALTER TABLE `bauteil`
ADD CONSTRAINT `bauteil_ibfk_1` FOREIGN KEY (`tree_typ_ID`) REFERENCES `tree_typ` (`ID`) ON UPDATE CASCADE,
ADD CONSTRAINT `bauteil_ibfk_2` FOREIGN KEY (`Foto_ID`) REFERENCES `foto` (`ID`) ON DELETE NO ACTION ON UPDATE CASCADE;

--
-- Constraints for table `bauteiladr`
--
ALTER TABLE `bauteiladr`
ADD CONSTRAINT `bauteiladr_ibfk_1` FOREIGN KEY (`Bauteil_ID`) REFERENCES `bauteil` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `bauteiladr_ibfk_2` FOREIGN KEY (`Adr_ID`) REFERENCES `adr` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `bauteiladr_ibfk_3` FOREIGN KEY (`BauteilLager_ID`) REFERENCES `bauteillager` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `bauteiladr_ibfk_4` FOREIGN KEY (`Foto_ID`) REFERENCES `foto` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Constraints for table `bauteilbewegung`
--
ALTER TABLE `bauteilbewegung`
ADD CONSTRAINT `bauteilbewegung_ibfk_1` FOREIGN KEY (`Bauteil_ID`) REFERENCES `bauteil` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `bauteilbewegung_ibfk_2` FOREIGN KEY (`BauteilLager_ID`) REFERENCES `bauteillager` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `bauteilbewegung_ibfk_3` FOREIGN KEY (`Bestellen_ID`) REFERENCES `bestellen` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE,
ADD CONSTRAINT `bauteilbewegung_ibfk_4` FOREIGN KEY (`Projekt_ID`) REFERENCES `projekt` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE,
ADD CONSTRAINT `bauteilbewegung_ibfk_5` FOREIGN KEY (`ProjektPos_ID`) REFERENCES `projektpos` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Constraints for table `bauteillager`
--
ALTER TABLE `bauteillager`
ADD CONSTRAINT `bauteillager_ibfk_1` FOREIGN KEY (`Bauteil_ID`) REFERENCES `bauteil` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `bauteillager_ibfk_2` FOREIGN KEY (`Gehause_ID`) REFERENCES `gehause` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE,
ADD CONSTRAINT `bauteillager_ibfk_3` FOREIGN KEY (`Kiste_ID`) REFERENCES `kiste` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE,
ADD CONSTRAINT `bauteillager_ibfk_4` FOREIGN KEY (`Adr_ID`) REFERENCES `adr` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE,
ADD CONSTRAINT `bauteillager_ibfk_5` FOREIGN KEY (`Foto_ID`) REFERENCES `foto` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Constraints for table `bestellen`
--
ALTER TABLE `bestellen`
ADD CONSTRAINT `bestellen_ibfk_1` FOREIGN KEY (`Bauteil_ID`) REFERENCES `bauteil` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE,
ADD CONSTRAINT `bestellen_ibfk_11` FOREIGN KEY (`Lief1_Adr_ID`) REFERENCES `adr` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE,
ADD CONSTRAINT `bestellen_ibfk_12` FOREIGN KEY (`Lief1_BauteilAdr_ID`) REFERENCES `bauteiladr` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE,
ADD CONSTRAINT `bestellen_ibfk_2` FOREIGN KEY (`BauteilLager_ID`) REFERENCES `bauteillager` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE,
ADD CONSTRAINT `bestellen_ibfk_21` FOREIGN KEY (`Lief2_Adr_ID`) REFERENCES `adr` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE,
ADD CONSTRAINT `bestellen_ibfk_22` FOREIGN KEY (`Lief2_BauteilAdr_ID`) REFERENCES `bauteiladr` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE,
ADD CONSTRAINT `bestellen_ibfk_3` FOREIGN KEY (`Foto_ID`) REFERENCES `foto` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE,
ADD CONSTRAINT `bestellen_ibfk_4` FOREIGN KEY (`Projekt_ID`) REFERENCES `projekt` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Constraints for table `doku`
--
ALTER TABLE `doku`
ADD CONSTRAINT `doku_ibfk_1` FOREIGN KEY (`ID_ID_Version`) REFERENCES `doku` (`ID`) ON UPDATE CASCADE,
ADD CONSTRAINT `doku_ibfk_2` FOREIGN KEY (`Foto_ID`) REFERENCES `foto` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE,
ADD CONSTRAINT `doku_ibfk_3` FOREIGN KEY (`Bauteil_ID`) REFERENCES `bauteil` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE,
ADD CONSTRAINT `doku_ibfk_4` FOREIGN KEY (`BauteilLager_ID`) REFERENCES `bauteillager` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Constraints for table `foto`
--
ALTER TABLE `foto`
ADD CONSTRAINT `foto_ibfk_1` FOREIGN KEY (`ID_ID`) REFERENCES `foto` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `gehause`
--
ALTER TABLE `gehause`
ADD CONSTRAINT `gehause_ibfk_1` FOREIGN KEY (`Foto_ID`) REFERENCES `foto` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Constraints for table `historie`
--
ALTER TABLE `historie`
ADD CONSTRAINT `historie_ibfk_1` FOREIGN KEY (`Projekt_ID`) REFERENCES `projekt` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `historie_ibfk_2` FOREIGN KEY (`ProjektPos_ID`) REFERENCES `projektpos` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE,
ADD CONSTRAINT `historie_ibfk_3` FOREIGN KEY (`Kosten_ID`) REFERENCES `kosten` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE,
ADD CONSTRAINT `historie_ibfk_4` FOREIGN KEY (`Foto_ID`) REFERENCES `foto` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE,
ADD CONSTRAINT `historie_ibfk_5` FOREIGN KEY (`Adr_ID`) REFERENCES `adr` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE,
ADD CONSTRAINT `historie_ibfk_6` FOREIGN KEY (`AdrK_ID`) REFERENCES `adr` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Constraints for table `kiste`
--
ALTER TABLE `kiste`
ADD CONSTRAINT `kiste_ibfk_1` FOREIGN KEY (`Foto_ID`) REFERENCES `foto` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Constraints for table `kosten`
--
ALTER TABLE `kosten`
ADD CONSTRAINT `kosten_ibfk_1` FOREIGN KEY (`Projekt_ID`) REFERENCES `projekt` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `kosten_ibfk_2` FOREIGN KEY (`Adr_ID`) REFERENCES `adr` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE,
ADD CONSTRAINT `kosten_ibfk_3` FOREIGN KEY (`AdrK_ID`) REFERENCES `adr` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE,
ADD CONSTRAINT `kosten_ibfk_4` FOREIGN KEY (`Foto_ID`) REFERENCES `foto` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Constraints for table `kostenpos`
--
ALTER TABLE `kostenpos`
ADD CONSTRAINT `kostenpos_ibfk_1` FOREIGN KEY (`Projekt_ID`) REFERENCES `projekt` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `kostenpos_ibfk_2` FOREIGN KEY (`Kosten_ID`) REFERENCES `kosten` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `kostenpos_ibfk_3` FOREIGN KEY (`ProjektPos_ID`) REFERENCES `projektpos` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE,
ADD CONSTRAINT `kostenpos_ibfk_4` FOREIGN KEY (`Bauteil_ID`) REFERENCES `bauteil` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE,
ADD CONSTRAINT `kostenpos_ibfk_5` FOREIGN KEY (`BauteilLager_ID`) REFERENCES `bauteillager` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE,
ADD CONSTRAINT `kostenpos_ibfk_6` FOREIGN KEY (`Foto_ID`) REFERENCES `foto` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Constraints for table `projekt`
--
ALTER TABLE `projekt`
ADD CONSTRAINT `projekt_ibfk_1` FOREIGN KEY (`ID_ID`) REFERENCES `projekt` (`ID`) ON UPDATE CASCADE,
ADD CONSTRAINT `projekt_ibfk_2` FOREIGN KEY (`ID_ID_Version`) REFERENCES `projekt` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE,
ADD CONSTRAINT `projekt_ibfk_3` FOREIGN KEY (`ProjektVersion_ID`) REFERENCES `projektversion` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE,
ADD CONSTRAINT `projekt_ibfk_4` FOREIGN KEY (`Foto_ID`) REFERENCES `foto` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE,
ADD CONSTRAINT `projekt_ibfk_5` FOREIGN KEY (`Bauteil_ID`) REFERENCES `bauteil` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE,
ADD CONSTRAINT `projekt_ibfk_6` FOREIGN KEY (`BauteilLager_ID`) REFERENCES `bauteillager` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE,
ADD CONSTRAINT `projekt_ibfk_7` FOREIGN KEY (`Adr_ID`) REFERENCES `adr` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Constraints for table `projektdoku`
--
ALTER TABLE `projektdoku`
ADD CONSTRAINT `projektdoku_ibfk_1` FOREIGN KEY (`ID_ID_Version`) REFERENCES `projektdoku` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `projektdoku_ibfk_2` FOREIGN KEY (`Projekt_ID`) REFERENCES `projekt` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `projektdoku_ibfk_3` FOREIGN KEY (`ProjektVersion_ID`) REFERENCES `projektversion` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE,
ADD CONSTRAINT `projektdoku_ibfk_4` FOREIGN KEY (`Doku_ID`) REFERENCES `doku` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE,
ADD CONSTRAINT `projektdoku_ibfk_5` FOREIGN KEY (`Foto_ID`) REFERENCES `foto` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE,
ADD CONSTRAINT `projektdoku_ibfk_6` FOREIGN KEY (`Bauteil_ID`) REFERENCES `bauteil` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE,
ADD CONSTRAINT `projektdoku_ibfk_7` FOREIGN KEY (`BauteilLager_ID`) REFERENCES `bauteillager` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Constraints for table `projektpos`
--
ALTER TABLE `projektpos`
ADD CONSTRAINT `projektpos_ibfk_1` FOREIGN KEY (`ID_ID_Version`) REFERENCES `projektpos` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `projektpos_ibfk_2` FOREIGN KEY (`ProjektVersion_ID`) REFERENCES `projektversion` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE,
ADD CONSTRAINT `projektpos_ibfk_3` FOREIGN KEY (`Projekt_ID`) REFERENCES `projekt` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `projektpos_ibfk_4` FOREIGN KEY (`Bauteil_ID`) REFERENCES `bauteil` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE,
ADD CONSTRAINT `projektpos_ibfk_5` FOREIGN KEY (`BauteilLager_ID`) REFERENCES `bauteillager` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE,
ADD CONSTRAINT `projektpos_ibfk_6` FOREIGN KEY (`Foto_ID`) REFERENCES `foto` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Constraints for table `projektversion`
--
ALTER TABLE `projektversion`
ADD CONSTRAINT `projektversion_ibfk_1` FOREIGN KEY (`ID_ID`) REFERENCES `projektversion` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE,
ADD CONSTRAINT `projektversion_ibfk_2` FOREIGN KEY (`Foto_ID`) REFERENCES `foto` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE,
ADD CONSTRAINT `projektversion_ibfk_3` FOREIGN KEY (`Projekt_ID`) REFERENCES `projekt` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `projektversion_ibfk_4` FOREIGN KEY (`Bauteil_ID`) REFERENCES `bauteil` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE,
ADD CONSTRAINT `projektversion_ibfk_5` FOREIGN KEY (`BauteilLager_ID`) REFERENCES `bauteillager` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Constraints for table `storeteile`
--
ALTER TABLE `storeteile`
ADD CONSTRAINT `storeteile_ibfk_1` FOREIGN KEY (`StoreUser_ID`) REFERENCES `storeuser` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `tree_typ`
--
ALTER TABLE `tree_typ`
ADD CONSTRAINT `tree_typ_ibfk_1` FOREIGN KEY (`ID_ID`) REFERENCES `tree_typ` (`ID`) ON UPDATE CASCADE,
ADD CONSTRAINT `tree_typ_ibfk_2` FOREIGN KEY (`Foto_ID`) REFERENCES `foto` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Constraints for table `wissen`
--
ALTER TABLE `wissen`
ADD CONSTRAINT `wissen_ibfk_1` FOREIGN KEY (`Foto_ID`) REFERENCES `foto` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE;
COMMIT;

