· 6 years ago · Apr 30, 2019, 07:52 PM
1-- phpMyAdmin SQL Dump
2-- version 4.8.4
3-- https://www.phpmyadmin.net/
4--
5-- Host: 127.0.0.1:3306
6-- Czas generowania: 30 Kwi 2019, 19:48
7-- Wersja serwera: 5.7.24
8-- Wersja PHP: 7.2.14
9
10SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
11SET AUTOCOMMIT = 0;
12START TRANSACTION;
13SET time_zone = "+00:00";
14
15
16/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
17/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
18/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
19/*!40101 SET NAMES utf8mb4 */;
20
21--
22-- Baza danych: `warehouse`
23--
24
25-- --------------------------------------------------------
26
27--
28-- Struktura tabeli dla tabeli `access_cards`
29--
30
31DROP TABLE IF EXISTS `access_cards`;
32CREATE TABLE IF NOT EXISTS `access_cards` (
33 `id` int(11) NOT NULL AUTO_INCREMENT,
34 `number` int(11) DEFAULT NULL,
35 `user_id` int(11) NOT NULL,
36 PRIMARY KEY (`id`),
37 UNIQUE KEY `user_id` (`user_id`),
38 UNIQUE KEY `number` (`number`)
39) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_polish_ci;
40
41--
42-- Zrzut danych tabeli `access_cards`
43--
44
45INSERT INTO `access_cards` (`id`, `number`, `user_id`) VALUES
46(1, NULL, 1),
47(2, NULL, 2),
48(3, NULL, 3),
49(5, NULL, 5),
50(6, NULL, 6);
51
52-- --------------------------------------------------------
53
54--
55-- Struktura tabeli dla tabeli `logs`
56--
57
58DROP TABLE IF EXISTS `logs`;
59CREATE TABLE IF NOT EXISTS `logs` (
60 `id` int(11) NOT NULL AUTO_INCREMENT,
61 `log_action_id` int(11) NOT NULL,
62 `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
63 `value` text COLLATE utf8mb4_polish_ci NOT NULL,
64 PRIMARY KEY (`id`),
65 KEY `log_action_id` (`log_action_id`)
66) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_polish_ci;
67
68-- --------------------------------------------------------
69
70--
71-- Struktura tabeli dla tabeli `log_action`
72--
73
74DROP TABLE IF EXISTS `log_action`;
75CREATE TABLE IF NOT EXISTS `log_action` (
76 `id` int(11) NOT NULL AUTO_INCREMENT,
77 `action` varchar(50) COLLATE utf8mb4_polish_ci NOT NULL,
78 PRIMARY KEY (`id`)
79) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_polish_ci;
80
81-- --------------------------------------------------------
82
83--
84-- Struktura tabeli dla tabeli `parcel`
85--
86
87DROP TABLE IF EXISTS `parcel`;
88CREATE TABLE IF NOT EXISTS `parcel` (
89 `id` int(11) NOT NULL AUTO_INCREMENT,
90 `width` decimal(2,2) NOT NULL,
91 `height` decimal(2,2) NOT NULL,
92 `length` decimal(2,2) NOT NULL,
93 `weight` decimal(4,2) NOT NULL,
94 `fargile` tinyint(1) NOT NULL DEFAULT '0',
95 PRIMARY KEY (`id`)
96) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_polish_ci;
97
98-- --------------------------------------------------------
99
100--
101-- Struktura tabeli dla tabeli `shipment`
102--
103
104DROP TABLE IF EXISTS `shipment`;
105CREATE TABLE IF NOT EXISTS `shipment` (
106 `id` int(11) NOT NULL AUTO_INCREMENT,
107 `parcel_id` int(11) NOT NULL,
108 `manager_id` int(11) NOT NULL,
109 `employee_id` int(11) NOT NULL,
110 `shipment_location_id` int(11) NOT NULL,
111 `shipment_status_id` int(11) NOT NULL,
112 `modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
113 `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
114 PRIMARY KEY (`id`),
115 UNIQUE KEY `parcel_id` (`parcel_id`),
116 UNIQUE KEY `manager_id` (`manager_id`,`employee_id`),
117 KEY `employee_id` (`employee_id`),
118 KEY `shipment_status_id` (`shipment_status_id`),
119 KEY `shipment_location_id` (`shipment_location_id`)
120) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_polish_ci;
121
122-- --------------------------------------------------------
123
124--
125-- Struktura tabeli dla tabeli `shipment_location`
126--
127
128DROP TABLE IF EXISTS `shipment_location`;
129CREATE TABLE IF NOT EXISTS `shipment_location` (
130 `id` int(11) NOT NULL AUTO_INCREMENT,
131 `city` varchar(100) COLLATE utf8mb4_polish_ci NOT NULL,
132 `street` varchar(255) COLLATE utf8mb4_polish_ci NOT NULL,
133 `nr_1` int(4) NOT NULL,
134 `nr_2` int(4) NOT NULL,
135 PRIMARY KEY (`id`)
136) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_polish_ci;
137
138-- --------------------------------------------------------
139
140--
141-- Struktura tabeli dla tabeli `shipment_status`
142--
143
144DROP TABLE IF EXISTS `shipment_status`;
145CREATE TABLE IF NOT EXISTS `shipment_status` (
146 `id` int(11) NOT NULL AUTO_INCREMENT,
147 `status` varchar(50) COLLATE utf8mb4_polish_ci NOT NULL,
148 PRIMARY KEY (`id`)
149) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_polish_ci;
150
151-- --------------------------------------------------------
152
153--
154-- Struktura tabeli dla tabeli `users`
155--
156
157DROP TABLE IF EXISTS `users`;
158CREATE TABLE IF NOT EXISTS `users` (
159 `id` int(11) NOT NULL AUTO_INCREMENT,
160 `username` varchar(100) COLLATE utf8mb4_polish_ci NOT NULL,
161 `password` varchar(255) COLLATE utf8mb4_polish_ci NOT NULL,
162 `user_status_id` int(11) NOT NULL,
163 PRIMARY KEY (`id`),
164 KEY `user_status_id` (`user_status_id`)
165) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_polish_ci;
166
167-- --------------------------------------------------------
168
169--
170-- Struktura tabeli dla tabeli `user_status`
171--
172
173DROP TABLE IF EXISTS `user_status`;
174CREATE TABLE IF NOT EXISTS `user_status` (
175 `id` int(11) NOT NULL AUTO_INCREMENT,
176 `status` varchar(50) COLLATE utf8mb4_polish_ci NOT NULL,
177 PRIMARY KEY (`id`)
178) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_polish_ci;
179
180--
181-- Ograniczenia dla zrzutów tabel
182--
183
184--
185-- Ograniczenia dla tabeli `access_cards`
186--
187ALTER TABLE `access_cards`
188 ADD CONSTRAINT `access_cards_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);
189
190--
191-- Ograniczenia dla tabeli `logs`
192--
193ALTER TABLE `logs`
194 ADD CONSTRAINT `logs_ibfk_1` FOREIGN KEY (`log_action_id`) REFERENCES `log_action` (`id`);
195
196--
197-- Ograniczenia dla tabeli `shipment`
198--
199ALTER TABLE `shipment`
200 ADD CONSTRAINT `shipment_ibfk_1` FOREIGN KEY (`manager_id`) REFERENCES `users` (`id`),
201 ADD CONSTRAINT `shipment_ibfk_2` FOREIGN KEY (`employee_id`) REFERENCES `users` (`id`),
202 ADD CONSTRAINT `shipment_ibfk_3` FOREIGN KEY (`parcel_id`) REFERENCES `parcel` (`id`),
203 ADD CONSTRAINT `shipment_ibfk_4` FOREIGN KEY (`shipment_status_id`) REFERENCES `shipment_status` (`id`),
204 ADD CONSTRAINT `shipment_ibfk_5` FOREIGN KEY (`shipment_location_id`) REFERENCES `shipment_location` (`id`);
205
206--
207-- Ograniczenia dla tabeli `users`
208--
209ALTER TABLE `users`
210 ADD CONSTRAINT `users_ibfk_1` FOREIGN KEY (`user_status_id`) REFERENCES `user_status` (`id`);
211COMMIT;
212
213/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
214/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
215/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;