-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBookings.sql
More file actions
190 lines (155 loc) · 5.07 KB
/
Bookings.sql
File metadata and controls
190 lines (155 loc) · 5.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
-- phpMyAdmin SQL Dump
-- version 4.8.4
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: Nov 18, 2020 at 04:20 PM
-- Server version: 10.1.37-MariaDB
-- PHP Version: 5.6.40
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `Bookings`
--
CREATE DATABASE IF NOT EXISTS `Bookings` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
USE `Bookings`;
-- --------------------------------------------------------
--
-- Table structure for table `assets`
--
CREATE TABLE `assets` (
`asset_id` int(11) NOT NULL,
`asset_name` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`asset_type` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`asset_rooms` int(1) DEFAULT NULL,
`asset_double_beds` int(1) NOT NULL,
`asset_single_beds` int(1) NOT NULL,
`asset_sofa_bed` int(1) NOT NULL,
`asset_persons` int(1) DEFAULT NULL,
`asset_address` mediumtext COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `assets`
--
-- --------------------------------------------------------
--
-- Table structure for table `booking_details`
--
CREATE TABLE `booking_details` (
`booking_id` int(11) NOT NULL,
`booking_guest_name` varchar(40) COLLATE utf8_unicode_ci NOT NULL,
`booking_guest_surname` varchar(40) COLLATE utf8_unicode_ci NOT NULL,
`booking_guests_number` int(1) NOT NULL,
`guest_tel_number` varchar(14) COLLATE utf8_unicode_ci NOT NULL,
`booking_check_in` date NOT NULL,
`booking_check_out` date NOT NULL,
`booking_cost` double NOT NULL,
`booking_deposit` int(10) DEFAULT NULL,
`booking_commission` float DEFAULT NULL,
`booking_source` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
`booking_asset_id` int(11) NOT NULL,
`guest_email` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
`booking_notes` text COLLATE utf8_unicode_ci
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- --------------------------------------------------------
--
-- Table structure for table `prices`
--
CREATE TABLE `prices` (
`period_id` int(11) NOT NULL,
`asset_id` int(11) NOT NULL,
`price` float DEFAULT NULL,
`start_period` date DEFAULT NULL,
`end_period` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`user_id` int(11) NOT NULL,
`user_username` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL,
`user_name` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL,
`user_surname` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL,
`user_password` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`user_photo` mediumtext COLLATE utf8_unicode_ci,
`user_type` int(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`user_id`, `user_username`, `user_name`, `user_surname`, `user_password`, `user_photo`, `user_type`) VALUES
(1, 'admin', 'admin', '123', 'd033e22ae348aeb5660fc2140aec35850c4da997', 'avatar.png', 1);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `assets`
--
ALTER TABLE `assets`
ADD PRIMARY KEY (`asset_id`);
--
-- Indexes for table `booking_details`
--
ALTER TABLE `booking_details`
ADD PRIMARY KEY (`booking_id`),
ADD KEY `booking_asset_id` (`booking_asset_id`);
--
-- Indexes for table `prices`
--
ALTER TABLE `prices`
ADD PRIMARY KEY (`period_id`),
ADD KEY `asset_id` (`asset_id`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`user_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `assets`
--
ALTER TABLE `assets`
MODIFY `asset_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=29;
--
-- AUTO_INCREMENT for table `booking_details`
--
ALTER TABLE `booking_details`
MODIFY `booking_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21;
--
-- AUTO_INCREMENT for table `prices`
--
ALTER TABLE `prices`
MODIFY `period_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `user_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=24;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `booking_details`
--
ALTER TABLE `booking_details`
ADD CONSTRAINT `booking_details_ibfk_1` FOREIGN KEY (`booking_asset_id`) REFERENCES `assets` (`asset_id`) ON DELETE NO ACTION ON UPDATE CASCADE;
--
-- Constraints for table `prices`
--
ALTER TABLE `prices`
ADD CONSTRAINT `prices_ibfk_1` FOREIGN KEY (`asset_id`) REFERENCES `assets` (`asset_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;