-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.fs
111 lines (97 loc) · 5.17 KB
/
Program.fs
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
module PgGen.Main
open Build
let proteins =
db "proteins" [ Owner "read_write" ] [
schema "enzyme" [] [
table "organism" [] [
col "id" Id []
col "name" String []
col "id_taxon" Int32 [Nullable]
col "common_name" String [Nullable]
col "taxonomy" String [Nullable ; Array]
]
table "tombstone" [] [
col "id" Id []
col "name" String []
col "processed" Timestamp []
]
table "uniprot_entry" [] [
col "id" Id []
col "uniprot_kb_id" String [Nullable]
col "common_name" String [Nullable]
col "accno" String []
col "secondary" String [Array]
col "entry_version" Int32 []
col "seq_version" Int32 []
col "last_annotation_update" Timestamp []
col "last_seq_update" Timestamp []
frefId "ec_group" []
frefId "protein_sequence" []
frefId "organism" []
unique ["id_ec_group";"accno"]
]
table "uniprot_data" [ Comment "largely json structured data"] [
col "id" Id []
col "keywords" Jsonb [Array ; CComment "id, category, name triples"]
col "refs" Jsonb [Array]
col "comments" Jsonb [Array]
col "genes" Jsonb [Array]
col "features" Jsonb [Array]
col "created" Timestamp [ CUpdate Never]
col "updated" Timestamp [ CUpdate Now]
frefId "uniprot_entry" [] // associated uniprot_entry
]
table "uniprot_comment" [Comment "json structured data in coment field attached to a uniprot entry"] [
col "id" Id []
col "data" Jsonb []
frefId "uniprot_entry" [] // associated uniprot_entry
frefId "ec_group" [] // breaking denorm for convenience here
col "created" Timestamp [CUpdate Never]
]
table "uniprot_keyword" [Comment "json structured keywords attached to a uniprot entry"] [
col "id" Id []
col "data" Jsonb []
frefId "uniprot_entry" [] // associated uniprot_entry
frefId "ec_group" [] // breaking denorm for convenience here
col "created" Timestamp [CUpdate Never]
]
table "uniprot_ref" [Comment "json structured keywords attached to a uniprot entry"] [
col "id" Id []
col "data" Jsonb []
frefId "uniprot_entry" [] // associated uniprot_entry
frefId "ec_group" [] // breaking denorm for convenience here
col "created" Timestamp [CUpdate Never]
]
table "uniprot_gene" [Comment "json structured gene data attached to a uniprot entry"] [
col "id" Id []
col "data" Jsonb []
frefId "uniprot_entry" [] // associated uniprot_entry
frefId "ec_group" [] // breaking denorm for convenience here
col "created" Timestamp [CUpdate Never]
]
table "uniprot_feature" [Comment "json structured features attached to a uniprot entry"] [
col "id" Id []
col "data" Jsonb []
frefId "uniprot_entry" [ FComment "associated uniprot_entry"]
frefId "ec_group" [ FComment "breaking denorm for convenience here"]
col "created" Timestamp [CUpdate Never]
]
table "uniprot_rxn" [Comment "text description of reactions and references to other rxn dbs"] [
col "id" Id []
col "name" String []
frefId "uniprot_entry" []
col "refs" String [ Array ] // "RHEA:39799", "CHEBI:15378"
]
]
schema "playground" [SComment "demo schema to show off all features"] [
enumDef "status" [ Member "new" ; Member "in_progress" ; Member "done" ; Member "cancelled" ; EComment "Status of a todo item" ]
table "todo_item" [] [
col "id" Id []
col "description" String []
col "data" Jsonb []
enum "status" [ ERComment "Status of a todo item" ]
]
]
]
let output = Generate.emitDatabase proteins
printfn $"{output}"