add SQL
This commit is contained in:
parent
df2dd3a49e
commit
e33c68cb05
1 changed files with 40 additions and 0 deletions
40
init.sql
Normal file
40
init.sql
Normal file
|
@ -0,0 +1,40 @@
|
|||
create table meals
|
||||
(
|
||||
id int auto_increment
|
||||
primary key,
|
||||
name text not null,
|
||||
description text null
|
||||
)
|
||||
;
|
||||
|
||||
create table menus
|
||||
(
|
||||
date date not null,
|
||||
id int auto_increment
|
||||
primary key,
|
||||
venue int not null,
|
||||
meal int not null,
|
||||
constraint eindeutig
|
||||
unique (venue, date),
|
||||
constraint menus_meals_id_fk
|
||||
foreign key (meal) references hunger.meals (id)
|
||||
)
|
||||
;
|
||||
|
||||
create index menus_meals_id_fk
|
||||
on menus (meal)
|
||||
;
|
||||
|
||||
create table venues
|
||||
(
|
||||
id int auto_increment
|
||||
primary key,
|
||||
name text null
|
||||
)
|
||||
;
|
||||
|
||||
alter table menus
|
||||
add constraint menus_ibfk_1
|
||||
foreign key (venue) references hunger.venues (id)
|
||||
;
|
||||
|
Reference in a new issue