This repository has been archived by the owner on Feb 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mds-projeto.sql.orig
195 lines (163 loc) · 4.69 KB
/
mds-projeto.sql.orig
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
191
192
193
194
195
-- phpMyAdmin SQL Dump
-- version 4.6.5.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
<<<<<<< Updated upstream
-- Generation Time: Jun 02, 2017 at 05:06 PM
-- Server version: 10.1.19-MariaDB
=======
-- Generation Time: 02-Jun-2017 às 17:13
-- Versão do servidor: 10.1.21-MariaDB
>>>>>>> Stashed changes
-- PHP Version: 7.0.9
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
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: `mds-projeto`
--
CREATE DATABASE IF NOT EXISTS `mds-projeto` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `mds-projeto`;
-- --------------------------------------------------------
--
<<<<<<< Updated upstream
-- Table structure for table `consultas`
--
CREATE TABLE `consultas` (
`id` int(11) NOT NULL,
`id_medico` int(11) NOT NULL,
`id_paciente` int(11) NOT NULL,
`hora` datetime NOT NULL,
`data` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `consultas`
--
INSERT INTO `consultas` (`id`, `id_medico`, `id_paciente`, `hora`, `data`) VALUES
(1, 2, 1, '2017-06-14 05:06:00', '2017-06-14 00:00:00'),
(2, 2, 2, '2017-06-14 08:00:00', '2017-06-07 00:00:00');
-- --------------------------------------------------------
--
-- Table structure for table `medico`
=======
-- Estrutura da tabela `medico`
>>>>>>> Stashed changes
--
CREATE TABLE `medico` (
`id` int(11) NOT NULL,
<<<<<<< Updated upstream
`especialidade` varchar(50) NOT NULL,
`entrada` datetime NOT NULL,
`saida` datetime NOT NULL,
`segSocial` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `medico`
--
INSERT INTO `medico` (`id`, `especialidade`, `entrada`, `saida`, `segSocial`) VALUES
(2, '0', '2017-06-02 14:46:45', '2017-06-02 14:46:45', 0);
=======
`especialidade` int(11) NOT NULL,
`entrada` time NOT NULL,
`saida` time NOT NULL,
`segSocial` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
>>>>>>> Stashed changes
-- --------------------------------------------------------
--
-- Estrutura da tabela `paciente`
--
CREATE TABLE `paciente` (
`id` int(11) NOT NULL,
`nome` varchar(45) NOT NULL,
`data_nasc` datetime NOT NULL,
`cod_postal` varchar(8) NOT NULL,
`nacionalidade` varchar(20) NOT NULL,
`nif` int(9) NOT NULL,
`cc` int(11) NOT NULL,
`sns` int(11) NOT NULL,
`avatar` varchar(50) DEFAULT NULL,
`id_user` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `paciente`
--
INSERT INTO `paciente` (`id`, `nome`, `data_nasc`, `cod_postal`, `nacionalidade`, `nif`, `cc`, `sns`, `avatar`, `id_user`) VALUES
(1, 'xico', '2017-06-06 00:00:00', '123', '123', 123, 123, 123, '123', 1),
(2, 'joao', '2017-06-16 00:00:00', '123', '123', 123, 123, 123, '123', 1);
-- --------------------------------------------------------
--
-- Estrutura da tabela `users`
--
CREATE TABLE `users` (
`id` int(11) NOT NULL,
`username` varchar(50) NOT NULL,
`password` varchar(64) NOT NULL,
`permissao` int(11) NOT NULL COMMENT '0-medico 1-rececionista 2-admin'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `medico`
--
ALTER TABLE `medico`
<<<<<<< Updated upstream
ADD PRIMARY KEY (`id`),
ADD KEY `id` (`id`);
=======
ADD PRIMARY KEY (`id`);
>>>>>>> Stashed changes
--
-- Indexes for table `paciente`
--
ALTER TABLE `paciente`
ADD PRIMARY KEY (`id`),
ADD KEY `fk_user_paciente` (`id_user`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `username` (`username`);
--
-- AUTO_INCREMENT for dumped tables
--
--
<<<<<<< Updated upstream
-- AUTO_INCREMENT for table `consultas`
--
ALTER TABLE `consultas`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
=======
>>>>>>> Stashed changes
-- AUTO_INCREMENT for table `paciente`
--
ALTER TABLE `paciente`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- Constraints for dumped tables
--
--
-- Limitadores para a tabela `medico`
--
ALTER TABLE `medico`
ADD CONSTRAINT `medico_ibfk_1` FOREIGN KEY (`id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
--
-- Limitadores para a tabela `paciente`
--
ALTER TABLE `paciente`
ADD CONSTRAINT `fk_user_paciente` FOREIGN KEY (`id_user`) REFERENCES `users` (`id`);
/*!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 */;