Commit c3efbef4 authored by Gerd Schachtschneider's avatar Gerd Schachtschneider
Browse files

init chem

parent 5ad67a1e
......@@ -25,7 +25,7 @@ Dort liegen auch alle noch notwendigen SQL-Skripte fuer die DB-Erstellung und we
## Screenshot ##
<a href="install/db_gfk.png" title="Ueberblick Datenbanken"><img src="install/db_gfk.png" align="left" height="100" width="100"></a>
<a href="install/db_gfk.png" title="Datenbank Gefahrenklassen"><img src="install/db_gfk.png" align="left" height="100" width="100"></a>
<br><br><br><br>
## Warnhinweis ##
......
......@@ -7,7 +7,7 @@ Was muss ich anpassen:
Initialer Login ist admin mit Passwort admin
sollte man irgendwann aendern
2. Datenbank anlegen mit sql Skript install/mpidb_mpg_user.sql
2. Datenbank anlegen mit sql Skript install/mpidb_mpg_<db>.sql
bei Update install/updateDB_<version>.sql
3. domain, hostname, ssl, user, password unbedingt anpassen in
......@@ -20,7 +20,7 @@ Was muss ich anpassen:
5. wenn es eine seperate User-Datenbank gibt, dann folgende SQL-Skripte ausfuehren
mysql -p -u root < install/joinGfk2User.sql
6. Verbindung zu Chemie-Datenbanken herstellen und folgende SQL-Skripte ausfuehren
6. Verbindungen zu Chemie-Datenbanken herstellen und folgende SQL-Skripte ausfuehren
mysql -p -u root < install/joinGfk2Chem.sql
mysql -p -u root < install/joinChem2Gfk.sql
......
-- view auf list_lgk von db gfk - version mpg
CREATE OR REPLACE VIEW mpidb_mpg_chem.view_lgk AS
SELECT
autoID,
lgk,
beschreibung,
priority
FROM
mpidb_mpg_gfk.list_lgk
;
-- view auf list_gefahr von db gfk - version mpg
CREATE OR REPLACE VIEW mpidb_mpg_chem.view_gefahr AS
SELECT
autoID,
kategorie,
hsatz,
merkmal,
anweisung,
lgk
FROM
mpidb_mpg_gfk.list_gefahr
;
......@@ -3,7 +3,7 @@
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Mar 01, 2016 at 01:54 PM
-- Generation Time: Mar 10, 2016 at 08:39 AM
-- Server version: 5.5.47-0ubuntu0.14.04.1-log
-- PHP Version: 5.5.9-1ubuntu4.14
......@@ -17,7 +17,7 @@ SET time_zone = "+00:00";
/*!40101 SET NAMES utf8 */;
--
-- Database: `mpidb_asi_inv`
-- Database: `mpidb_mpg_gfk`
--
CREATE DATABASE IF NOT EXISTS `mpidb_mpg_gfk` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
USE `mpidb_mpg_gfk`;
......@@ -56,6 +56,64 @@ DELIMITER ;
-- --------------------------------------------------------
--
-- Table structure for table `dataface__failed_logins`
--
CREATE TABLE IF NOT EXISTS `dataface__failed_logins` (
`attempt_id` int(11) NOT NULL AUTO_INCREMENT,
`ip_address` varchar(32) NOT NULL,
`username` varchar(32) NOT NULL,
`time_of_attempt` int(11) NOT NULL,
PRIMARY KEY (`attempt_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `dataface__modules`
--
CREATE TABLE IF NOT EXISTS `dataface__modules` (
`module_name` varchar(255) NOT NULL,
`module_version` int(11) DEFAULT NULL,
PRIMARY KEY (`module_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `dataface__mtimes`
--
CREATE TABLE IF NOT EXISTS `dataface__mtimes` (
`name` varchar(255) NOT NULL,
`mtime` int(11) DEFAULT NULL,
PRIMARY KEY (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `dataface__mtimes`
--
INSERT INTO `dataface__mtimes` (`name`, `mtime`) VALUES
('dataface__failed_logins', 1456840851),
('dataface__modules', 1456840652),
('dataface__mtimes', 1456840652),
('dataface__version', 1456840652),
('list_gefahr', 1456840652),
('list_katReiter', 1456840652),
('list_lgk', 1456840652),
('list_reiter', 1456840652),
('mpi_users', 1456840652),
('view_chemAll', 1456840652),
('view_favorit', 1456840652),
('view_gefahr', 1456840652),
('view_reiter', 1456840652),
('view_user', 1456840652);
-- --------------------------------------------------------
--
-- Table structure for table `dataface__version`
--
......@@ -304,25 +362,23 @@ INSERT INTO `list_reiter` (`autoID`, `reiter`, `kategorie`, `favorit`, `history`
--
CREATE TABLE IF NOT EXISTS `mpi_users` (
`userID` smallint(3) NOT NULL AUTO_INCREMENT,
`userID` smallint(6) unsigned zerofill NOT NULL AUTO_INCREMENT,
`username` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
`password` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`role` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
`email` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`zeitstempel` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`userID`),
UNIQUE KEY `username` (`username`),
UNIQUE KEY `email` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=6 ;
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ;
--
-- Dumping data for table `mpi_users`
--
INSERT INTO `mpi_users` (`userID`, `username`, `role`, `email`, `zeitstempel`) VALUES
(1, 'schachi', 'MANAGER', 'schachi@mpi-magdeburg.mpg.de', '2012-04-24 09:47:58'),
(2, 'danker', 'ADMIN', 'danker@mpi-magdeburg.mpg.de', '2012-04-26 04:07:57'),
(4, 'hermsdorf', 'ADMIN', 'hermsdorf@mpi-magdeburg.mpg.de', '2012-07-27 13:59:31'),
(5, 'schaefer', 'ADMIN', 'schaefer@mpi-magdeburg.mpg.de', '2012-11-19 10:14:25');
INSERT INTO `mpi_users` (`userID`, `username`, `password`, `role`, `email`, `zeitstempel`) VALUES
(000001, 'admin', 'd033e22ae348aeb5660fc2140aec35850c4da997', 'MANAGER', '', '0000-00-00 00:00:00');
-- --------------------------------------------------------
......@@ -330,16 +386,16 @@ INSERT INTO `mpi_users` (`userID`, `username`, `role`, `email`, `zeitstempel`) V
-- Stand-in structure for view `view_chemAll`
--
CREATE TABLE IF NOT EXISTS `view_chemAll` (
`tabID` smallint(6)
,`substanz` varchar(100)
,`reinheit` varchar(40)
,`lgk` varchar(10)
,`cmr` tinyint(4)
,`cas` varchar(20)
,`einheit` varchar(25)
`tabID` varchar(1)
,`substanz` varchar(30)
,`reinheit` varchar(1)
,`lgk` varchar(1)
,`cmr` varchar(1)
,`cas` varchar(1)
,`einheit` varchar(1)
,`gruppe` varchar(3)
,`bearbeiter` varchar(20)
,`zeitstempel` timestamp
,`bearbeiter` varchar(7)
,`zeitstempel` varchar(19)
);
-- --------------------------------------------------------
......@@ -359,14 +415,13 @@ CREATE TABLE IF NOT EXISTS `view_favorit` (
-- Stand-in structure for view `view_gefahr`
--
CREATE TABLE IF NOT EXISTS `view_gefahr` (
`autoID` smallint(6)
,`tabID` smallint(6)
,`substanz` varchar(100)
,`kategorie` varchar(30)
,`bemerkung` tinytext
`autoID` varchar(1)
,`tabID` varchar(1)
,`substanz` varchar(30)
,`kategorie` varchar(1)
,`gruppe` varchar(3)
,`bearbeiter` varchar(20)
,`zeitstempel` timestamp
,`bearbeiter` varchar(7)
,`zeitstempel` varchar(19)
);
-- --------------------------------------------------------
......@@ -383,9 +438,9 @@ CREATE TABLE IF NOT EXISTS `view_reiter` (
-- Stand-in structure for view `view_user`
--
CREATE TABLE IF NOT EXISTS `view_user` (
`localID` varchar(25)
,`last_name` varchar(30)
,`first_name` varchar(30)
`localID` varchar(5)
,`last_name` varchar(7)
,`first_name` varchar(3)
);
-- --------------------------------------------------------
......@@ -394,7 +449,7 @@ CREATE TABLE IF NOT EXISTS `view_user` (
--
DROP TABLE IF EXISTS `view_chemAll`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_chemAll` AS select `bio`.`tabID` AS `tabID`,`bio`.`substanz` AS `substanz`,`bio`.`reinheit` AS `reinheit`,`bio`.`lgk` AS `lgk`,`bio`.`cmr` AS `cmr`,`bio`.`cas` AS `cas`,`bio`.`einheit` AS `einheit`,'bio' AS `gruppe`,`bio`.`bearbeiter` AS `bearbeiter`,`bio`.`zeitstempel` AS `zeitstempel` from `mpidb_bio_chem`.`mpi_chemstoff` `bio` union all select `bpe`.`tabID` AS `tabID`,`bpe`.`substanz` AS `substanz`,`bpe`.`reinheit` AS `reinheit`,`bpe`.`lgk` AS `lgk`,`bpe`.`cmr` AS `cmr`,`bpe`.`cas` AS `cas`,`bpe`.`einheit` AS `einheit`,'bpe' AS `gruppe`,`bpe`.`bearbeiter` AS `bearbeiter`,`bpe`.`zeitstempel` AS `zeitstempel` from `mpidb_bpe_chem`.`mpi_chemstoff` `bpe` union all select `pcg`.`tabID` AS `tabID`,`pcg`.`substanz` AS `substanz`,`pcg`.`reinheit` AS `reinheit`,`pcg`.`lgk` AS `lgk`,`pcg`.`cmr` AS `cmr`,`pcg`.`cas` AS `cas`,`pcg`.`einheit` AS `einheit`,'pcg' AS `gruppe`,`pcg`.`bearbeiter` AS `bearbeiter`,`pcg`.`zeitstempel` AS `zeitstempel` from `mpidb_pcg_chem`.`mpi_chemstoff` `pcg` union all select `pse`.`tabID` AS `tabID`,`pse`.`substanz` AS `substanz`,`pse`.`reinheit` AS `reinheit`,`pse`.`lgk` AS `lgk`,`pse`.`cmr` AS `cmr`,`pse`.`cas` AS `cas`,`pse`.`einheit` AS `einheit`,'pse' AS `gruppe`,`pse`.`bearbeiter` AS `bearbeiter`,`pse`.`zeitstempel` AS `zeitstempel` from `mpidb_pse_chem`.`mpi_chemstoff` `pse`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_chemAll` AS select '1' AS `tabID`,'Fake Eintrag wenn keine chemDB' AS `substanz`,'-' AS `reinheit`,'-' AS `lgk`,'0' AS `cmr`,'-' AS `cas`,'-' AS `einheit`,'mpg' AS `gruppe`,'initial' AS `bearbeiter`,'2016-03-02 11:34:18' AS `zeitstempel`;
-- --------------------------------------------------------
......@@ -412,7 +467,7 @@ CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW
--
DROP TABLE IF EXISTS `view_gefahr`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_gefahr` AS select `bioT1`.`autoID` AS `autoID`,`bioT2`.`tabID` AS `tabID`,`bioT2`.`substanz` AS `substanz`,`bioT1`.`kategorie` AS `kategorie`,`bioT1`.`bemerkung` AS `bemerkung`,'bio' AS `gruppe`,`bioT1`.`bearbeiter` AS `bearbeiter`,`bioT1`.`zeitstempel` AS `zeitstempel` from (`mpidb_bio_chem`.`mpi_gefahr` `bioT1` join `mpidb_bio_chem`.`mpi_chemstoff` `bioT2`) where (`bioT1`.`chemID` = `bioT2`.`tabID`) union select `pcgT1`.`autoID` AS `autoID`,`pcgT2`.`tabID` AS `tabID`,`pcgT2`.`substanz` AS `substanz`,`pcgT1`.`kategorie` AS `kategorie`,`pcgT1`.`bemerkung` AS `bemerkung`,'pcg' AS `gruppe`,`pcgT1`.`bearbeiter` AS `bearbeiter`,`pcgT1`.`zeitstempel` AS `zeitstempel` from (`mpidb_pcg_chem`.`mpi_gefahr` `pcgT1` join `mpidb_pcg_chem`.`mpi_chemstoff` `pcgT2`) where (`pcgT1`.`chemID` = `pcgT2`.`tabID`) union select `bpeT1`.`autoID` AS `autoID`,`bpeT2`.`tabID` AS `tabID`,`bpeT2`.`substanz` AS `substanz`,`bpeT1`.`kategorie` AS `kategorie`,`bpeT1`.`bemerkung` AS `bemerkung`,'bpe' AS `gruppe`,`bpeT1`.`bearbeiter` AS `bearbeiter`,`bpeT1`.`zeitstempel` AS `zeitstempel` from (`mpidb_bpe_chem`.`mpi_gefahr` `bpeT1` join `mpidb_bpe_chem`.`mpi_chemstoff` `bpeT2`) where (`bpeT1`.`chemID` = `bpeT2`.`tabID`) union select `pseT1`.`autoID` AS `autoID`,`pseT2`.`tabID` AS `tabID`,`pseT2`.`substanz` AS `substanz`,`pseT1`.`kategorie` AS `kategorie`,`pseT1`.`bemerkung` AS `bemerkung`,'pse' AS `gruppe`,`pseT1`.`bearbeiter` AS `bearbeiter`,`pseT1`.`zeitstempel` AS `zeitstempel` from (`mpidb_pse_chem`.`mpi_gefahr` `pseT1` join `mpidb_pse_chem`.`mpi_chemstoff` `pseT2`) where (`pseT1`.`chemID` = `pseT2`.`tabID`);
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_gefahr` AS select '1' AS `autoID`,'1' AS `tabID`,'Noch nicht mit chemDB verlinkt' AS `substanz`,'-' AS `kategorie`,'mpg' AS `gruppe`,'initial' AS `bearbeiter`,'2016-03-02 11:34:18' AS `zeitstempel`;
-- --------------------------------------------------------
......@@ -430,7 +485,7 @@ CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW
--
DROP TABLE IF EXISTS `view_user`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_user` AS select `mpidb_user`.`mpi_user`.`localID` AS `localID`,`mpidb_user`.`mpi_user`.`last_name` AS `last_name`,`mpidb_user`.`mpi_user`.`first_name` AS `first_name` from `mpidb_user`.`mpi_user`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_user` AS select 'local' AS `localID`,'version' AS `last_name`,'mpg' AS `first_name` order by 'local';
--
-- Constraints for dumped tables
......
-- Fake view aus sich selbst
-- Version mpg ohne mpg_chem
-- version alone
-- fake auf sich selbst, also ohne db_chem's
CREATE OR REPLACE VIEW view_chemAll AS
SELECT
'1' AS tabID,
......@@ -14,8 +14,10 @@ CREATE OR REPLACE VIEW view_chemAll AS
'2016-03-02 11:34:18' AS zeitstempel
;
-- Version mpg mit mpg_chem
-- version mpg mit mpg_chem
-- entsprechend erweitern/anpassen, wenn mehr chemie-db's existieren
-- siehe Beispiel mpi-dcts (4db's) in ../tables/view_chemAll/view_chemAll.sql
CREATE OR REPLACE VIEW view_chemAll AS
SELECT
mpg.tabID AS tabID,
......@@ -32,7 +34,8 @@ CREATE OR REPLACE VIEW view_chemAll AS
;
-- Version mpi-dcts
-- version mpi-dcts
-- verknuepft mit 4 db's
CREATE OR REPLACE VIEW view_chemAll AS
SELECT
bio.tabID AS tabID,
......
......@@ -4,7 +4,7 @@ CREATE OR REPLACE VIEW view_gefahr AS
SELECT
'1' AS autoID,
'1' AS tabID,
'Fake Eintrag wenn keine chemDB' AS substanz,
'Noch nicht mit chemDB verlinkt' AS substanz,
'-' AS kategorie,
'mpg' AS gruppe,
'initial' AS bearbeiter,
......@@ -12,7 +12,8 @@ CREATE OR REPLACE VIEW view_gefahr AS
;
-- Version mpg mit mpg_chem
-- entsprechend erweitern/anpassen, wenn mehr chemie-db's existieren - siehe mpi-dcts
-- entsprechend erweitern/anpassen, wenn mehr chemie-db's existieren
-- siehe Beispiel mpi-dcts in ../tables/view_gefahr/view_gefahr.sql
CREATE OR REPLACE VIEW view_gefahr AS
SELECT
mpgT1.autoID,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment