Project

General

Profile

Customer Database » History » Version 6

Ryan Supawarapong, 04/01/2026 01:25 AM

1 1 Ryan Supawarapong
# Customer Database
2
3 4 Ryan Supawarapong
4 1 Ryan Supawarapong
```
5 5 Ryan Supawarapong
// 4 top layer 1
6
// Onboarding
7
// Customer
8
// Transaction: combine of customer and asset
9
// Digital Asset: asset_id
10 1 Ryan Supawarapong
11 5 Ryan Supawarapong
// Layer 2
12
// Fullname
13
// Customer info: link to transaction, onboarding
14
// customer suite test answer: answer
15
// suite test id: question and answer
16
17
// Layer 3
18
// suite test question and answer
19
// Knowledge test
20
21
22
// Layer 1
23
// ----------------------
24
// Onboarding
25
Table onboarding {
26 1 Ryan Supawarapong
  id int
27 5 Ryan Supawarapong
  register_id uuid
28
  customer_info_id int [ref: - customer_info.id]
29
  idcard_id int [ref: - idcard.id]
30
  occupation_id int [ref: - occupation.id]
31
  register_address_id int [ref : - address.id]
32
  current_address_id int [ref : - address.id]
33
  work_address_id int [ref : - address.id]
34
  customer_suite_id int [ref: - customer_suite_submission.id]
35
  cdd_id int [ref: - cdd.id]
36
  bank_id int [ref: - bank.id]
37
  secondary_bank_id int [ref: - bank.id]
38
  source_of_fund_id int [ref: - source_of_fund.id]
39
  thaid_id int [ref: - thaid.id]
40
  ndid_id int [ref: - ndid.id]
41
  approval_id int [ref: - approval.id]
42
  appman_id int [ref: - appman.id]
43
  risk_score_id int [ref: - risk_score.id]
44
  has_done_knowledge_test bool
45
  steps int
46 1 Ryan Supawarapong
}
47
48 5 Ryan Supawarapong
// Customer
49
Table customer {
50 1 Ryan Supawarapong
  id int
51 5 Ryan Supawarapong
  customer_info_id int [ref: - customer_info.id]
52
  risk_score_id int [ref: - risk_score.id]
53
  idcard_id int [ref: - idcard.id]
54
  occupation_id int [ref: - occupation.id]
55
  register_address_id int [ref : - address.id]
56
  current_address_id int [ref : - address.id]
57
  work_address_id int [ref : - address.id]
58
  customer_suite_id int [ref: - customer_suite_submission.id]
59
  bank_id int [ref: - bank.id]
60
  secondary_bank_id int [ref: - bank.id]
61
  source_of_fund_id int [ref: - source_of_fund.id]
62
63 1 Ryan Supawarapong
}
64
65 5 Ryan Supawarapong
// Transaction
66
Table transaction {
67
  id uuid
68
  seller_info_id int [ref: - customer_info.id]
69
}
70 1 Ryan Supawarapong
71 5 Ryan Supawarapong
// Digital Asset
72
Table digital_asset {
73 2 Ryan Supawarapong
  id uuid
74 5 Ryan Supawarapong
  customer_info_id int [ref: - customer_info.id]
75
  asset_detail_id int [ref: - asset_detail.id]
76
77 2 Ryan Supawarapong
}
78
79 5 Ryan Supawarapong
// ----------------------
80
// Layer 2
81
// ----------------------
82
Table customer_info {
83 2 Ryan Supawarapong
  id int
84 5 Ryan Supawarapong
  mobile string
85
  email string
86
  title_id int [ref: - title.id]
87
  first_name_th string
88
  middle_name_th string
89
  last_name_th string
90
  first_name_en string
91
  middle_name_en string
92
  last_name_en string
93
  customer_type enum
94
  ip_id int [ref: - ip_detail.id]
95 1 Ryan Supawarapong
}
96
97
Table address {
98
  id int
99
  house_number string
100
  floor string
101 2 Ryan Supawarapong
  village_building string
102
  sub_street strign
103 1 Ryan Supawarapong
  street strign
104
  country_code string
105
  location_id  int
106
}
107
108 5 Ryan Supawarapong
Table idcard {
109
  id int
110
  citizen_id  string
111
  laser_code string
112
  date_of_birth timestamp
113
  expire_date timestamp
114
  issue_date timestamp
115
}
116 1 Ryan Supawarapong
117 5 Ryan Supawarapong
Table occupation {
118 1 Ryan Supawarapong
  id int
119 5 Ryan Supawarapong
  code string
120
  position_name string
121
  source_of_investment string
122
  workplace_name string
123
  education_id string [ref: - education.id]
124
  occupation_id int [ref: - occupation.id]
125
  business_type_id int [ref: - business_type.id]
126
  income_range_id int [ref: - income_range.id]
127
  
128 1 Ryan Supawarapong
}
129
130 5 Ryan Supawarapong
Table customer_suite_answer {
131
  id int
132
  submission_id int [ref: > customer_suite_submission.id]
133
  question_id int [ref: > suitability_question.id]
134
  choice_id int [ref: > suitability_choice.id]
135
}
136 2 Ryan Supawarapong
137 5 Ryan Supawarapong
Table customer_suite_submission {
138
  id int
139
  customer_info_id int [ref: > customer_info.id]
140
  total_score int
141
  risk_level string
142
}
143 1 Ryan Supawarapong
144 2 Ryan Supawarapong
145 5 Ryan Supawarapong
Table cdd {
146 1 Ryan Supawarapong
  id int
147 5 Ryan Supawarapong
  mule string
148
  freeze_04 string
149
  freeze_05 string
150
  pep bool
151
  pep_message string
152
  dopa bool
153 1 Ryan Supawarapong
}
154
155 5 Ryan Supawarapong
Table appman {
156 2 Ryan Supawarapong
  id int
157 5 Ryan Supawarapong
  verification_id string
158
  idcard_id int [ref: - appman_id_card.id]
159
  liveness_id int [ref: - appman_liveness.id]
160
  liveness_attribute_id int [ref: - appman_liveness_attributes.id]
161
  recognition int [ref: - appman_recognition.id]
162 1 Ryan Supawarapong
}
163
164 5 Ryan Supawarapong
Table bank { //
165 1 Ryan Supawarapong
  id int
166 5 Ryan Supawarapong
  name string
167
  branch string
168
  account_no string
169 1 Ryan Supawarapong
}
170
171 5 Ryan Supawarapong
Table source_of_fund { //
172
  id int
173
  source_of_fund string
174
  country_of_income string
175
  purpose_of_investment string
176
}
177 1 Ryan Supawarapong
178 5 Ryan Supawarapong
Table thaid {
179 1 Ryan Supawarapong
  id int
180 5 Ryan Supawarapong
  url string
181
  state string
182
  thaid_detail_id int [ref: - thaid_detail.id]
183 1 Ryan Supawarapong
}
184
185 5 Ryan Supawarapong
Table ndid {
186 1 Ryan Supawarapong
  id int
187 5 Ryan Supawarapong
  ndid_detail_id int [ref: - ndid_detail.id]
188 1 Ryan Supawarapong
}
189
190 5 Ryan Supawarapong
Table approval {
191 1 Ryan Supawarapong
  id int
192 5 Ryan Supawarapong
  by string
193
  name string
194
  level int
195
  message string
196
  is_approve bool
197 1 Ryan Supawarapong
}
198
199 5 Ryan Supawarapong
Table risk_score {
200 1 Ryan Supawarapong
  id int
201 5 Ryan Supawarapong
  score int
202
  risk_level int
203
}
204
205
Table asset_detail {
206
  id int
207 2 Ryan Supawarapong
  name string
208 5 Ryan Supawarapong
  price float
209 2 Ryan Supawarapong
}
210
211
// ----------------------
212 5 Ryan Supawarapong
// Layer 3
213
// ----------------------
214 2 Ryan Supawarapong
215 5 Ryan Supawarapong
Table suitability_question {
216
  id int
217
  question string
218 2 Ryan Supawarapong
}
219
220 5 Ryan Supawarapong
Table suitability_choice {
221
  id int 
222
  question_id int [ref: > suitability_question.id]
223
  answer string
224
  score int
225
}
226
227
Table appman_id_card {
228 2 Ryan Supawarapong
  id int
229
}
230
231 5 Ryan Supawarapong
Table appman_liveness {
232 2 Ryan Supawarapong
  id int
233
}
234
235 5 Ryan Supawarapong
Table appman_liveness_attributes {
236 2 Ryan Supawarapong
  id int
237
}
238
239 5 Ryan Supawarapong
Table appman_recognition {
240
  id int
241
}
242
243
Table education {
244
  id int
245
  code string
246
  name string
247
}
248
249
Table business_type {
250
  id int
251
  name string
252
  risk_score int
253
}
254
255
Table income_range {
256
  id int
257
  range string
258
}
259
260
Table thaid_detail {
261
  id int
262
}
263
264
Table ndid_detail {
265
  id int
266
}
267
268
Table ip_detail {
269
  id int
270
  ip_address string
271
  country string
272
}
273
274
Table title {
275
  id int
276
  name_en string
277
  name_th string
278
}
279
280
// ----------------------
281
282
283 6 Ryan Supawarapong
```
284 5 Ryan Supawarapong
285 1 Ryan Supawarapong
286 6 Ryan Supawarapong
Tree layer version:
287
```
288
.
289
├── Layer 1
290
│   ├── onboarding
291
│   │   ├── id: int
292
│   │   ├── register_id: uuid
293
│   │   ├── customer_info_id: int [ref: customer_info.id]
294
│   │   ├── idcard_id: int [ref: idcard.id]
295
│   │   ├── occupation_id: int [ref: occupation.id]
296
│   │   ├── register_address_id: int [ref: address.id]
297
│   │   ├── current_address_id: int [ref: address.id]
298
│   │   ├── work_address_id: int [ref: address.id]
299
│   │   ├── customer_suite_id: int [ref: customer_suite_submission.id]
300
│   │   ├── cdd_id: int [ref: cdd.id]
301
│   │   ├── bank_id: int [ref: bank.id]
302
│   │   ├── secondary_bank_id: int [ref: bank.id]
303
│   │   ├── source_of_fund_id: int [ref: source_of_fund.id]
304
│   │   ├── thaid_id: int [ref: thaid.id]
305
│   │   ├── ndid_id: int [ref: ndid.id]
306
│   │   ├── approval_id: int [ref: approval.id]
307
│   │   ├── appman_id: int [ref: appman.id]
308
│   │   ├── risk_score_id: int [ref: risk_score.id]
309
│   │   ├── has_done_knowledge_test: bool
310
│   │   └── steps: int
311
│   ├── customer
312
│   │   ├── id: int
313
│   │   ├── customer_info_id: int [ref: customer_info.id]
314
│   │   ├── risk_score_id: int [ref: risk_score.id]
315
│   │   ├── idcard_id: int [ref: idcard.id]
316
│   │   ├── occupation_id: int [ref: occupation.id]
317
│   │   ├── register_address_id: int [ref: address.id]
318
│   │   ├── current_address_id: int [ref: address.id]
319
│   │   ├── work_address_id: int [ref: address.id]
320
│   │   ├── customer_suite_id: int [ref: customer_suite_submission.id]
321
│   │   ├── bank_id: int [ref: bank.id]
322
│   │   ├── secondary_bank_id: int [ref: bank.id]
323
│   │   └── source_of_fund_id: int [ref: source_of_fund.id]
324
│   ├── transaction
325
│   │   ├── id: uuid
326
│   │   └── seller_info_id: int [ref: customer_info.id]
327
│   └── digital_asset
328
│       ├── id: uuid
329
│       ├── customer_info_id: int [ref: customer_info.id]
330
│       └── asset_detail_id: int [ref: asset_detail.id]
331
├── Layer 2
332
│   ├── customer_info
333
│   │   ├── id: int
334
│   │   ├── mobile: string
335
│   │   ├── email: string
336
│   │   ├── title_id: int [ref: title.id]
337
│   │   ├── first_name_th: string
338
│   │   ├── middle_name_th: string
339
│   │   ├── last_name_th: string
340
│   │   ├── first_name_en: string
341
│   │   ├── middle_name_en: string
342
│   │   ├── last_name_en: string
343
│   │   ├── customer_type: enum
344
│   │   └── ip_id: int [ref: ip_detail.id]
345
│   ├── address
346
│   │   ├── id: int
347
│   │   ├── house_number: string
348
│   │   ├── floor: string
349
│   │   ├── village_building: string
350
│   │   ├── sub_street: string
351
│   │   ├── street: string
352
│   │   ├── country_code: string
353
│   │   └── location_id: int
354
│   ├── idcard
355
│   │   ├── id: int
356
│   │   ├── citizen_id: string
357
│   │   ├── laser_code: string
358
│   │   ├── date_of_birth: timestamp
359
│   │   ├── expire_date: timestamp
360
│   │   └── issue_date: timestamp
361
│   ├── occupation
362
│   │   ├── id: int
363
│   │   ├── code: string
364
│   │   ├── position_name: string
365
│   │   ├── source_of_investment: string
366
│   │   ├── workplace_name: string
367
│   │   ├── education_id: string [ref: education.id]
368
│   │   ├── occupation_id: int [ref: occupation.id]
369
│   │   ├── business_type_id: int [ref: business_type.id]
370
│   │   └── income_range_id: int [ref: income_range.id]
371
│   ├── customer_suite_answer
372
│   │   ├── id: int
373
│   │   ├── submission_id: int [ref: customer_suite_submission.id]
374
│   │   ├── question_id: int [ref: suitability_question.id]
375
│   │   └── choice_id: int [ref: suitability_choice.id]
376
│   ├── customer_suite_submission
377
│   │   ├── id: int
378
│   │   ├── customer_info_id: int [ref: customer_info.id]
379
│   │   ├── total_score: int
380
│   │   └── risk_level: string
381
│   ├── cdd
382
│   │   ├── id: int
383
│   │   ├── mule: string
384
│   │   ├── freeze_04: string
385
│   │   ├── freeze_05: string
386
│   │   ├── pep: bool
387
│   │   ├── pep_message: string
388
│   │   └── dopa: bool
389
│   ├── appman
390
│   │   ├── id: int
391
│   │   ├── verification_id: string
392
│   │   ├── idcard_id: int [ref: appman_id_card.id]
393
│   │   ├── liveness_id: int [ref: appman_liveness.id]
394
│   │   ├── liveness_attribute_id: int [ref: appman_liveness_attributes.id]
395
│   │   └── recognition: int [ref: appman_recognition.id]
396
│   ├── bank
397
│   │   ├── id: int
398
│   │   ├── name: string
399
│   │   ├── branch: string
400
│   │   └── account_no: string
401
│   ├── source_of_fund
402
│   │   ├── id: int
403
│   │   ├── source_of_fund: string
404
│   │   ├── country_of_income: string
405
│   │   └── purpose_of_investment: string
406
│   ├── thaid
407
│   │   ├── id: int
408
│   │   ├── url: string
409
│   │   ├── state: string
410
│   │   └── thaid_detail_id: int [ref: thaid_detail.id]
411
│   ├── ndid
412
│   │   ├── id: int
413
│   │   └── ndid_detail_id: int [ref: ndid_detail.id]
414
│   ├── approval
415
│   │   ├── id: int
416
│   │   ├── by: string
417
│   │   ├── name: string
418
│   │   ├── level: int
419
│   │   ├── message: string
420
│   │   └── is_approve: bool
421
│   ├── risk_score
422
│   │   ├── id: int
423
│   │   ├── score: int
424
│   │   └── risk_level: int
425
│   └── asset_detail
426
│       ├── id: int
427
│       ├── name: string
428
│       └── price: float
429
└── Layer 3
430
    ├── suitability_question
431
    │   ├── id: int
432
    │   └── question: string
433
    ├── suitability_choice
434
    │   ├── id: int
435
    │   ├── question_id: int [ref: suitability_question.id]
436
    │   ├── answer: string
437
    │   └── score: int
438
    ├── appman_id_card
439
    │   └── id: int
440
    ├── appman_liveness
441
    │   └── id: int
442
    ├── appman_liveness_attributes
443
    │   └── id: int
444
    ├── appman_recognition
445
    │   └── id: int
446
    ├── education
447
    │   ├── id: int
448
    │   ├── code: string
449
    │   └── name: string
450
    ├── business_type
451
    │   ├── id: int
452
    │   ├── name: string
453
    │   └── risk_score: int
454
    ├── income_range
455
    │   ├── id: int
456
    │   └── range: string
457
    ├── thaid_detail
458
    │   └── id: int
459
    ├── ndid_detail
460
    │   └── id: int
461
    ├── ip_detail
462
    │   ├── id: int
463
    │   ├── ip_address: string
464
    │   └── country: string
465
    └── title
466
        ├── id: int
467
        ├── name_en: string
468
        └── name_th: string
469 1 Ryan Supawarapong
```