-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.hcl
61 lines (57 loc) · 1001 Bytes
/
schema.hcl
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
schema "main" {}
table "tasks" {
schema = schema.main
column "id" {
type = integer
null = false
}
column "name" {
type = text
null = false
}
column "description" {
type = text
null = false
}
column "parent_id" {
type = integer
null = true
}
primary_key {
columns = [column.id]
}
foreign_key "fk_tasks_parent" {
columns = [column.parent_id]
ref_columns = [column.id]
on_delete = CASCADE
on_update = CASCADE
}
}
table "sessions" {
schema = schema.main
column "id" {
type = integer
null = false
}
column "task_id" {
type = integer
null = false
}
column "started_at" {
type = integer
null = false
}
column "ended_at" {
type = integer
null = false
}
primary_key {
columns = [column.id]
}
foreign_key "fk_tasks_sessions" {
columns = [column.task_id]
ref_columns = [table.tasks.column.id]
on_delete = CASCADE
on_update = CASCADE
}
}