-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase.sql
More file actions
executable file
·33 lines (27 loc) · 831 Bytes
/
database.sql
File metadata and controls
executable file
·33 lines (27 loc) · 831 Bytes
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
DROP DATABASE IF EXISTS admin_locales;
CREATE DATABASE admin_locales;
use admin_locales;
CREATE TABLE categories(
name VARCHAR(20) PRIMARY KEY
);
INSERT INTO categories VALUES ('general');
CREATE TABLE locales(name VARCHAR(20) PRIMARY KEY,
address VARCHAR(20),
opening_hours VARCHAR(200),
take_away BOOLEAN,
deliverys BOOLEAN,
restaurant_menu VARCHAR(200),
whatsapp VARCHAR(12),
web VARCHAR(200),
email VARCHAR(200),
url_foto VARCHAR(200),
validated BOOLEAN,
category VARCHAR(40),
CONSTRAINT fk_locales_categoria FOREIGN KEY(category) REFERENCES categories(name)
);
CREATE TABLE phones(
name VARCHAR(20),
phone VARCHAR(12),
CONSTRAINT pk_phones PRIMARY KEY(name,phone),
CONSTRAINT fk_phones_locales FOREIGN KEY(name) REFERENCES locales(name)
);