deno.land / x / pasta@0.0.6 / src / database / custom-schema.ts

custom-schema.ts
نووسراو ببینە
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
112
113
114
115
116
117
118
119
120
import { JSONValue, TimestampFunctionCall } from "./pg-catalog.ts";type Tables = { account: { keys: { id: number; }; columns: { id?: number; name: string; deactivated_at?: string | TimestampFunctionCall; created_at?: string | TimestampFunctionCall }; associations: | { user: { email: string } } | { user_account: { user_id: number } }; }, settings: { keys: { key: string; }; columns: { key: string; value: string; created_at?: string | TimestampFunctionCall }; associations: | never; }, user: { keys: { id: number; } | { email: string; }; columns: { id?: number; email: string; created_at?: string | TimestampFunctionCall; tags?: JSONValue }; associations: | { account: { name: string } } | { user_account: { account_id: number } }; }, user_account: { keys: { id: number; } | { user_id: number; account_id: number; }; columns: { id?: number; user_id: number; account_id: number; created_at?: string | TimestampFunctionCall }; associations: | { account: { name: string } } | { user: { email: string } }; }}type TableName = keyof Tables;type Association =| { kind: "1xN"; table: TableName; fks: Record<string, string> }| { kind: "MxN"; table: TableName; associativeTable: TableName; fks: Record<string, [string, string]>;};type Associations = Record<TableName, Record<string, Association>>;
const associations: Associations = { account: { user_account: { kind: "1xN", table: "user_account", fks: { account_id: "id" } }, user: { kind: "MxN", associativeTable: "user_account", table: "user", fks: {"account_id":["account","id"],"user_id":["user","id"]} } }, settings: { }, user: { user_account: { kind: "1xN", table: "user_account", fks: { user_id: "id" } }, account: { kind: "MxN", associativeTable: "user_account", table: "account", fks: {"user_id":["user","id"],"account_id":["account","id"]} } }, user_account: { account: { kind: "1xN", table: "account", fks: { id: "account_id" } }, user: { kind: "1xN", table: "user", fks: { id: "user_id" } } }};
export type { TableName, Tables };export { associations };
pasta

Version Info

Tagged at
a year ago