source: trunk/SQL/3.sql

Last change on this file was 56, checked in by chronos, 12 years ago
File size: 4.1 KB
Line 
1-- phpMyAdmin SQL Dump
2-- version 3.4.11.1deb1
3-- http://www.phpmyadmin.net
4--
5-- Počítač: localhost
6-- Vygenerováno: Úte 13. lis 2012, 21:55
7-- Verze MySQL: 5.5.28
8-- Verze PHP: 5.4.6-1ubuntu1
9
10SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
11SET time_zone = "+00:00";
12
13--
14-- Databáze: `dochazka`
15--
16
17-- --------------------------------------------------------
18
19--
20-- Struktura tabulky `Attendance`
21--
22
23CREATE TABLE IF NOT EXISTS `Attendance` (
24 `Id` int(11) NOT NULL AUTO_INCREMENT,
25 `User` int(11) NOT NULL,
26 `TimeFrom` time NOT NULL,
27 `TimeTo` time NOT NULL,
28 PRIMARY KEY (`Id`),
29 KEY `User` (`User`)
30) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
31
32-- --------------------------------------------------------
33
34--
35-- Struktura tabulky `Holiday`
36--
37
38CREATE TABLE IF NOT EXISTS `Holiday` (
39 `Id` int(11) NOT NULL AUTO_INCREMENT,
40 `Date` date NOT NULL,
41 `Name` varchar(255) CHARACTER SET utf8 COLLATE utf8_czech_ci NOT NULL,
42 PRIMARY KEY (`Id`)
43) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
44
45-- --------------------------------------------------------
46
47--
48-- Struktura tabulky `Log`
49--
50
51CREATE TABLE IF NOT EXISTS `Log` (
52 `Id` int(11) NOT NULL AUTO_INCREMENT,
53 `Time` datetime NOT NULL,
54 `User` int(11) NOT NULL,
55 `Text` varchar(255) CHARACTER SET utf8 COLLATE utf8_czech_ci NOT NULL,
56 PRIMARY KEY (`Id`),
57 KEY `User` (`User`)
58) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
59
60-- --------------------------------------------------------
61
62--
63-- Struktura tabulky `Operation`
64--
65
66CREATE TABLE IF NOT EXISTS `Operation` (
67 `Id` int(11) NOT NULL AUTO_INCREMENT,
68 `Name` varchar(255) CHARACTER SET utf8 COLLATE utf8_czech_ci NOT NULL,
69 `KeyId` int(11) NOT NULL,
70 PRIMARY KEY (`Id`)
71) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
72
73-- --------------------------------------------------------
74
75--
76-- Struktura tabulky `Passage`
77--
78
79CREATE TABLE IF NOT EXISTS `Passage` (
80 `Id` int(11) NOT NULL AUTO_INCREMENT,
81 `Time` datetime NOT NULL,
82 `User` int(11) NOT NULL,
83 `Operation` int(11) NOT NULL,
84 `Terminal` int(11) NOT NULL,
85 PRIMARY KEY (`Id`),
86 KEY `Terminal` (`Terminal`),
87 KEY `Operation` (`Operation`),
88 KEY `User` (`User`)
89) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
90
91-- --------------------------------------------------------
92
93--
94-- Struktura tabulky `Terminal`
95--
96
97CREATE TABLE IF NOT EXISTS `Terminal` (
98 `Id` int(11) NOT NULL,
99 `Name` varchar(255) CHARACTER SET utf8 COLLATE utf8_czech_ci NOT NULL,
100 `Enabled` tinyint(1) NOT NULL,
101 `Addreess` varchar(255) CHARACTER SET utf8 COLLATE utf8_czech_ci NOT NULL,
102 `Port` int(11) NOT NULL,
103 `Type` int(11) NOT NULL,
104 `Note` text CHARACTER SET utf8 COLLATE utf8_czech_ci NOT NULL,
105 PRIMARY KEY (`Id`)
106) ENGINE=InnoDB DEFAULT CHARSET=latin1;
107
108-- --------------------------------------------------------
109
110--
111-- Struktura tabulky `User`
112--
113
114CREATE TABLE IF NOT EXISTS `User` (
115 `Id` int(11) NOT NULL AUTO_INCREMENT,
116 `Login` varchar(255) CHARACTER SET utf8 COLLATE utf8_czech_ci NOT NULL,
117 `Password` varchar(255) CHARACTER SET utf8 COLLATE utf8_czech_ci NOT NULL,
118 `FirstName` varchar(255) CHARACTER SET utf8 COLLATE utf8_czech_ci NOT NULL,
119 `SecondName` varchar(255) CHARACTER SET utf8 COLLATE utf8_czech_ci NOT NULL,
120 `Enabled` tinyint(1) NOT NULL,
121 `CardCode` varchar(255) CHARACTER SET utf8 COLLATE utf8_czech_ci NOT NULL,
122 `Fingerprint` varchar(255) CHARACTER SET utf8 COLLATE utf8_czech_ci NOT NULL,
123 `Note` int(11) NOT NULL,
124 PRIMARY KEY (`Id`)
125) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
126
127--
128-- Omezení pro exportované tabulky
129--
130
131--
132-- Omezení pro tabulku `Attendance`
133--
134ALTER TABLE `Attendance`
135 ADD CONSTRAINT `Attendance_ibfk_1` FOREIGN KEY (`User`) REFERENCES `User` (`Id`);
136
137--
138-- Omezení pro tabulku `Log`
139--
140ALTER TABLE `Log`
141 ADD CONSTRAINT `Log_ibfk_1` FOREIGN KEY (`User`) REFERENCES `User` (`Id`);
142
143--
144-- Omezení pro tabulku `Passage`
145--
146ALTER TABLE `Passage`
147 ADD CONSTRAINT `Passage_ibfk_3` FOREIGN KEY (`Terminal`) REFERENCES `Terminal` (`Id`),
148 ADD CONSTRAINT `Passage_ibfk_1` FOREIGN KEY (`User`) REFERENCES `User` (`Id`),
149 ADD CONSTRAINT `Passage_ibfk_2` FOREIGN KEY (`Operation`) REFERENCES `Operation` (`Id`);
Note: See TracBrowser for help on using the repository browser.