-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblood-bank.sql
70 lines (59 loc) · 2.7 KB
/
blood-bank.sql
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
-- Adminer 4.7.0 MySQL dump
SET NAMES utf8;
SET time_zone = '+00:00';
SET foreign_key_checks = 0;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
DROP DATABASE IF EXISTS `blood-bank`;
CREATE DATABASE `blood-bank` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `blood-bank`;
DROP TABLE IF EXISTS `blood_request_tracker`;
CREATE TABLE `blood_request_tracker` (
`receiver_id` int(11) NOT NULL,
`sample_id` bigint(20) NOT NULL,
`hospital_id` int(11) NOT NULL,
`date_requested` varchar(255) NOT NULL,
UNIQUE KEY `receiver_id_sample_id` (`receiver_id`,`sample_id`),
KEY `sample_id` (`sample_id`),
KEY `hospital_id` (`hospital_id`),
CONSTRAINT `blood_request_tracker_ibfk_3` FOREIGN KEY (`receiver_id`) REFERENCES `receiver` (`receiver_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `blood_request_tracker_ibfk_4` FOREIGN KEY (`sample_id`) REFERENCES `blood_sample` (`sample_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `blood_request_tracker_ibfk_6` FOREIGN KEY (`hospital_id`) REFERENCES `hospital` (`hospital_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `blood_sample`;
CREATE TABLE `blood_sample` (
`sample_id` bigint(20) NOT NULL AUTO_INCREMENT,
`hospital_id` int(11) NOT NULL,
`sample_name` varchar(255) NOT NULL,
`sample_type` varchar(5) NOT NULL,
`sample_rhd` varchar(5) NOT NULL,
`date_added` varchar(255) NOT NULL,
PRIMARY KEY (`sample_id`),
KEY `hospital_id` (`hospital_id`),
CONSTRAINT `blood_sample_ibfk_2` FOREIGN KEY (`hospital_id`) REFERENCES `hospital` (`hospital_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `hospital`;
CREATE TABLE `hospital` (
`hospital_id` int(11) NOT NULL AUTO_INCREMENT,
`hospital_name` varchar(255) NOT NULL,
`hospital_address` varchar(500) NOT NULL,
`hospital_feature_image` varchar(255) DEFAULT NULL,
`hospital_contact_email` varchar(255) NOT NULL,
`hospital_password` char(60) NOT NULL,
`date_added` varchar(255) NOT NULL,
PRIMARY KEY (`hospital_id`),
UNIQUE KEY `hospital_contact_email` (`hospital_contact_email`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `receiver`;
CREATE TABLE `receiver` (
`receiver_id` int(11) NOT NULL AUTO_INCREMENT,
`receiver_name` varchar(255) NOT NULL,
`receiver_address` varchar(500) NOT NULL,
`receiver_contact_email` varchar(255) NOT NULL,
`receiver_blood_type` varchar(5) NOT NULL,
`receiver_blood_rhd` varchar(5) NOT NULL,
`receiver_password` char(60) NOT NULL,
`date_added` varchar(255) NOT NULL,
PRIMARY KEY (`receiver_id`),
UNIQUE KEY `receiver_contact_email` (`receiver_contact_email`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- 2020-10-23 14:41:24