Project

General

Profile

Customer Database » History » Version 7

Ryan Supawarapong, 04/01/2026 02:05 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 7 Ryan Supawarapong
  register_id string
230
  verification_id string
231
  id_number string
232
  address_th string
233
  full_name_th string
234
  full_name_en string
235
  serial_number string
236
  date_birth_en string
237
  date_birth_th string
238
  date_issue_en string
239
  date_issue_th string
240
  date_expire_en string
241
  date_expire_th string
242
  laser_code string
243
  updated_at timestamp
244 5 Ryan Supawarapong
}
245 2 Ryan Supawarapong
246 1 Ryan Supawarapong
Table appman_liveness {
247 7 Ryan Supawarapong
  id int [pk, increment]
248
  register_id string
249
  verification_id string
250
  verified bool
251
  valid bool
252
  completed bool
253
  success bool
254
  was_processed bool
255
  scan_result_blob text
256
  updated_at timestamp
257 2 Ryan Supawarapong
}
258 5 Ryan Supawarapong
259 2 Ryan Supawarapong
Table appman_liveness_attributes {
260 1 Ryan Supawarapong
  id int
261 7 Ryan Supawarapong
  register_id string
262
  verification_id string
263
  yaw float
264
  roll float
265
  pitch float
266
  is_beard bool
267
  beard_confidence float
268
  is_smile bool
269
  smile_confidence float
270
  gender string
271
  gender_confidence float
272
  sharpness float
273
  brightness float
274
  age_low int
275
  age_high int
276
  is_eyes_open bool
277
  eyes_open_confidence float
278
  is_mustache bool
279
  mustache_confidence float
280
  is_mouth_open bool
281
  mouth_open_confidence float
282
  confidence float
283
  is_eyeglasses bool
284
  eyeglasses_confidence float
285
  is_sunglasses bool
286
  sunglasses_confidence float
287 5 Ryan Supawarapong
}
288
289
Table appman_recognition {
290 1 Ryan Supawarapong
  id int
291 7 Ryan Supawarapong
  register_id string
292
  verification_id string
293
  yaw float
294
  roll float
295
  pitch float
296
  sharpness float
297
  brightness float
298
  top float
299
  left float
300
  width float
301
  height float
302
  similarity float
303
  pass_similarity bool
304
  confidence float
305
  verified bool
306
  valid bool
307
  completed bool
308
  source_key string
309
  target_key string
310
  source_url string
311
  target_url string
312
  updated_at timestamp
313 5 Ryan Supawarapong
}
314
Table education {
315
  id int
316
  code string
317
  name string
318
}
319
320
Table business_type {
321
  id int
322
  name string
323
  risk_score int
324
}
325
326
Table income_range {
327
  id int
328
  range string
329
}
330
331
Table thaid_detail {
332
  id int
333
}
334
335
Table ndid_detail {
336
  id int
337
}
338
339
Table ip_detail {
340
  id int
341
  ip_address string
342
  country string
343
}
344
345
Table title {
346
  id int
347
  name_en string
348
  name_th string
349
}
350
351
352 6 Ryan Supawarapong
```
353 5 Ryan Supawarapong
354 1 Ryan Supawarapong
355 6 Ryan Supawarapong
Tree layer version:
356
```
357
.
358
├── Layer 1
359
│   ├── onboarding
360
│   │   ├── id: int
361
│   │   ├── register_id: uuid
362
│   │   ├── customer_info_id: int [ref: customer_info.id]
363
│   │   ├── idcard_id: int [ref: idcard.id]
364
│   │   ├── occupation_id: int [ref: occupation.id]
365
│   │   ├── register_address_id: int [ref: address.id]
366
│   │   ├── current_address_id: int [ref: address.id]
367
│   │   ├── work_address_id: int [ref: address.id]
368
│   │   ├── customer_suite_id: int [ref: customer_suite_submission.id]
369
│   │   ├── cdd_id: int [ref: cdd.id]
370
│   │   ├── bank_id: int [ref: bank.id]
371
│   │   ├── secondary_bank_id: int [ref: bank.id]
372
│   │   ├── source_of_fund_id: int [ref: source_of_fund.id]
373
│   │   ├── thaid_id: int [ref: thaid.id]
374
│   │   ├── ndid_id: int [ref: ndid.id]
375
│   │   ├── approval_id: int [ref: approval.id]
376
│   │   ├── appman_id: int [ref: appman.id]
377
│   │   ├── risk_score_id: int [ref: risk_score.id]
378
│   │   ├── has_done_knowledge_test: bool
379
│   │   └── steps: int
380
│   ├── customer
381
│   │   ├── id: int
382
│   │   ├── customer_info_id: int [ref: customer_info.id]
383
│   │   ├── risk_score_id: int [ref: risk_score.id]
384
│   │   ├── idcard_id: int [ref: idcard.id]
385
│   │   ├── occupation_id: int [ref: occupation.id]
386
│   │   ├── register_address_id: int [ref: address.id]
387
│   │   ├── current_address_id: int [ref: address.id]
388
│   │   ├── work_address_id: int [ref: address.id]
389
│   │   ├── customer_suite_id: int [ref: customer_suite_submission.id]
390
│   │   ├── bank_id: int [ref: bank.id]
391
│   │   ├── secondary_bank_id: int [ref: bank.id]
392
│   │   └── source_of_fund_id: int [ref: source_of_fund.id]
393
│   ├── transaction
394
│   │   ├── id: uuid
395
│   │   └── seller_info_id: int [ref: customer_info.id]
396
│   └── digital_asset
397
│       ├── id: uuid
398
│       ├── customer_info_id: int [ref: customer_info.id]
399
│       └── asset_detail_id: int [ref: asset_detail.id]
400
├── Layer 2
401
│   ├── customer_info
402
│   │   ├── id: int
403
│   │   ├── mobile: string
404
│   │   ├── email: string
405
│   │   ├── title_id: int [ref: title.id]
406
│   │   ├── first_name_th: string
407
│   │   ├── middle_name_th: string
408
│   │   ├── last_name_th: string
409
│   │   ├── first_name_en: string
410
│   │   ├── middle_name_en: string
411
│   │   ├── last_name_en: string
412
│   │   ├── customer_type: enum
413
│   │   └── ip_id: int [ref: ip_detail.id]
414
│   ├── address
415
│   │   ├── id: int
416
│   │   ├── house_number: string
417
│   │   ├── floor: string
418
│   │   ├── village_building: string
419
│   │   ├── sub_street: string
420
│   │   ├── street: string
421
│   │   ├── country_code: string
422
│   │   └── location_id: int
423
│   ├── idcard
424
│   │   ├── id: int
425
│   │   ├── citizen_id: string
426
│   │   ├── laser_code: string
427
│   │   ├── date_of_birth: timestamp
428
│   │   ├── expire_date: timestamp
429
│   │   └── issue_date: timestamp
430
│   ├── occupation
431
│   │   ├── id: int
432
│   │   ├── code: string
433
│   │   ├── position_name: string
434
│   │   ├── source_of_investment: string
435
│   │   ├── workplace_name: string
436
│   │   ├── education_id: string [ref: education.id]
437
│   │   ├── occupation_id: int [ref: occupation.id]
438
│   │   ├── business_type_id: int [ref: business_type.id]
439
│   │   └── income_range_id: int [ref: income_range.id]
440
│   ├── customer_suite_answer
441
│   │   ├── id: int
442
│   │   ├── submission_id: int [ref: customer_suite_submission.id]
443
│   │   ├── question_id: int [ref: suitability_question.id]
444
│   │   └── choice_id: int [ref: suitability_choice.id]
445
│   ├── customer_suite_submission
446
│   │   ├── id: int
447
│   │   ├── customer_info_id: int [ref: customer_info.id]
448
│   │   ├── total_score: int
449
│   │   └── risk_level: string
450
│   ├── cdd
451
│   │   ├── id: int
452
│   │   ├── mule: string
453
│   │   ├── freeze_04: string
454
│   │   ├── freeze_05: string
455
│   │   ├── pep: bool
456
│   │   ├── pep_message: string
457
│   │   └── dopa: bool
458
│   ├── appman
459
│   │   ├── id: int
460
│   │   ├── verification_id: string
461
│   │   ├── idcard_id: int [ref: appman_id_card.id]
462
│   │   ├── liveness_id: int [ref: appman_liveness.id]
463
│   │   ├── liveness_attribute_id: int [ref: appman_liveness_attributes.id]
464
│   │   └── recognition: int [ref: appman_recognition.id]
465
│   ├── bank
466
│   │   ├── id: int
467
│   │   ├── name: string
468
│   │   ├── branch: string
469
│   │   └── account_no: string
470
│   ├── source_of_fund
471
│   │   ├── id: int
472
│   │   ├── source_of_fund: string
473
│   │   ├── country_of_income: string
474
│   │   └── purpose_of_investment: string
475
│   ├── thaid
476
│   │   ├── id: int
477
│   │   ├── url: string
478
│   │   ├── state: string
479
│   │   └── thaid_detail_id: int [ref: thaid_detail.id]
480
│   ├── ndid
481
│   │   ├── id: int
482
│   │   └── ndid_detail_id: int [ref: ndid_detail.id]
483
│   ├── approval
484
│   │   ├── id: int
485
│   │   ├── by: string
486
│   │   ├── name: string
487
│   │   ├── level: int
488
│   │   ├── message: string
489
│   │   └── is_approve: bool
490
│   ├── risk_score
491
│   │   ├── id: int
492
│   │   ├── score: int
493
│   │   └── risk_level: int
494
│   └── asset_detail
495
│       ├── id: int
496
│       ├── name: string
497
│       └── price: float
498
└── Layer 3
499
    ├── suitability_question
500
    │   ├── id: int
501
    │   └── question: string
502
    ├── suitability_choice
503 1 Ryan Supawarapong
    │   ├── id: int
504
    │   ├── question_id: int [ref: suitability_question.id]
505
    │   ├── answer: string
506
    │   └── score: int
507
    ├── appman_id_card
508 7 Ryan Supawarapong
    │   ├── id: int
509
    │   ├── register_id: string
510
    │   ├── verification_id: string
511
    │   ├── id_number: string
512
    │   ├── address_th: string
513
    │   ├── full_name_th: string
514
    │   ├── full_name_en: string
515
    │   ├── serial_number: string
516
    │   ├── date_birth_en: string
517
    │   ├── date_birth_th: string
518
    │   ├── date_issue_en: string
519
    │   ├── date_issue_th: string
520
    │   ├── date_expire_en: string
521
    │   ├── date_expire_th: string
522
    │   ├── laser_code: string
523
    │   └── updated_at: timestamp
524 1 Ryan Supawarapong
    ├── appman_liveness
525 7 Ryan Supawarapong
    │   ├── id: int [pk, increment]
526
    │   ├── register_id: string
527
    │   ├── verification_id: string
528
    │   ├── verified: bool
529
    │   ├── valid: bool
530
    │   ├── completed: bool
531
    │   ├── success: bool
532
    │   ├── was_processed: bool
533
    │   ├── scan_result_blob: text
534
    │   └── updated_at: timestamp
535 1 Ryan Supawarapong
    ├── appman_liveness_attributes
536 7 Ryan Supawarapong
    │   ├── id: int
537
    │   ├── register_id: string
538
    │   ├── verification_id: string
539
    │   ├── yaw: float
540
    │   ├── roll: float
541
    │   ├── pitch: float
542
    │   ├── is_beard: bool
543
    │   ├── beard_confidence: float
544
    │   ├── is_smile: bool
545
    │   ├── smile_confidence: float
546
    │   ├── gender: string
547
    │   ├── gender_confidence: float
548
    │   ├── sharpness: float
549
    │   ├── brightness: float
550
    │   ├── age_low: int
551
    │   ├── age_high: int
552
    │   ├── is_eyes_open: bool
553
    │   ├── eyes_open_confidence: float
554
    │   ├── is_mustache: bool
555
    │   ├── mustache_confidence: float
556
    │   ├── is_mouth_open: bool
557
    │   ├── mouth_open_confidence: float
558
    │   ├── confidence: float
559
    │   ├── is_eyeglasses: bool
560
    │   ├── eyeglasses_confidence: float
561
    │   ├── is_sunglasses: bool
562
    │   └── sunglasses_confidence: float
563 1 Ryan Supawarapong
    ├── appman_recognition
564 7 Ryan Supawarapong
    │   ├── id: int
565
    │   ├── register_id: string
566
    │   ├── verification_id: string
567
    │   ├── yaw: float
568
    │   ├── roll: float
569
    │   ├── pitch: float
570
    │   ├── sharpness: float
571
    │   ├── brightness: float
572
    │   ├── top: float
573
    │   ├── left: float
574
    │   ├── width: float
575
    │   ├── height: float
576
    │   ├── similarity: float
577
    │   ├── pass_similarity: bool
578
    │   ├── confidence: float
579
    │   ├── verified: bool
580
    │   ├── valid: bool
581
    │   ├── completed: bool
582
    │   ├── source_key: string
583
    │   ├── target_key: string
584
    │   ├── source_url: string
585
    │   ├── target_url: string
586
    │   └── updated_at: timestamp
587 6 Ryan Supawarapong
    ├── education
588
    │   ├── id: int
589
    │   ├── code: string
590
    │   └── name: string
591
    ├── business_type
592
    │   ├── id: int
593
    │   ├── name: string
594
    │   └── risk_score: int
595
    ├── income_range
596
    │   ├── id: int
597
    │   └── range: string
598
    ├── thaid_detail
599
    │   └── id: int
600
    ├── ndid_detail
601
    │   └── id: int
602
    ├── ip_detail
603
    │   ├── id: int
604
    │   ├── ip_address: string
605
    │   └── country: string
606
    └── title
607
        ├── id: int
608
        ├── name_en: string
609
        └── name_th: string
610 1 Ryan Supawarapong
```