Project

General

Profile

Customer Database » History » Version 8

Ryan Supawarapong, 04/01/2026 02:08 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 8 Ryan Supawarapong
  buyer_info_id int [ref: - customer_info.id]
70
  price float
71
  amount_per_unit float
72
  unit float
73 5 Ryan Supawarapong
}
74 1 Ryan Supawarapong
75 5 Ryan Supawarapong
// Digital Asset
76
Table digital_asset {
77 2 Ryan Supawarapong
  id uuid
78 5 Ryan Supawarapong
  customer_info_id int [ref: - customer_info.id]
79
  asset_detail_id int [ref: - asset_detail.id]
80
81 2 Ryan Supawarapong
}
82
83 5 Ryan Supawarapong
// ----------------------
84
// Layer 2
85
// ----------------------
86
Table customer_info {
87 2 Ryan Supawarapong
  id int
88 5 Ryan Supawarapong
  mobile string
89
  email string
90
  title_id int [ref: - title.id]
91
  first_name_th string
92
  middle_name_th string
93
  last_name_th string
94
  first_name_en string
95
  middle_name_en string
96
  last_name_en string
97
  customer_type enum
98
  ip_id int [ref: - ip_detail.id]
99 1 Ryan Supawarapong
}
100
101
Table address {
102
  id int
103
  house_number string
104
  floor string
105 2 Ryan Supawarapong
  village_building string
106
  sub_street strign
107 1 Ryan Supawarapong
  street strign
108
  country_code string
109
  location_id  int
110
}
111
112 5 Ryan Supawarapong
Table idcard {
113
  id int
114
  citizen_id  string
115
  laser_code string
116
  date_of_birth timestamp
117
  expire_date timestamp
118
  issue_date timestamp
119
}
120 1 Ryan Supawarapong
121 5 Ryan Supawarapong
Table occupation {
122 1 Ryan Supawarapong
  id int
123 5 Ryan Supawarapong
  code string
124
  position_name string
125
  source_of_investment string
126
  workplace_name string
127
  education_id string [ref: - education.id]
128
  occupation_id int [ref: - occupation.id]
129
  business_type_id int [ref: - business_type.id]
130
  income_range_id int [ref: - income_range.id]
131
  
132 1 Ryan Supawarapong
}
133
134 5 Ryan Supawarapong
Table customer_suite_answer {
135
  id int
136
  submission_id int [ref: > customer_suite_submission.id]
137
  question_id int [ref: > suitability_question.id]
138
  choice_id int [ref: > suitability_choice.id]
139
}
140 2 Ryan Supawarapong
141 5 Ryan Supawarapong
Table customer_suite_submission {
142
  id int
143
  customer_info_id int [ref: > customer_info.id]
144
  total_score int
145
  risk_level string
146
}
147 1 Ryan Supawarapong
148 2 Ryan Supawarapong
149 5 Ryan Supawarapong
Table cdd {
150 1 Ryan Supawarapong
  id int
151 5 Ryan Supawarapong
  mule string
152
  freeze_04 string
153
  freeze_05 string
154
  pep bool
155
  pep_message string
156
  dopa bool
157 1 Ryan Supawarapong
}
158
159 5 Ryan Supawarapong
Table appman {
160 2 Ryan Supawarapong
  id int
161 5 Ryan Supawarapong
  verification_id string
162
  idcard_id int [ref: - appman_id_card.id]
163
  liveness_id int [ref: - appman_liveness.id]
164
  liveness_attribute_id int [ref: - appman_liveness_attributes.id]
165
  recognition int [ref: - appman_recognition.id]
166 1 Ryan Supawarapong
}
167
168 5 Ryan Supawarapong
Table bank { //
169 1 Ryan Supawarapong
  id int
170 5 Ryan Supawarapong
  name string
171
  branch string
172
  account_no string
173 1 Ryan Supawarapong
}
174
175 5 Ryan Supawarapong
Table source_of_fund { //
176
  id int
177
  source_of_fund string
178
  country_of_income string
179
  purpose_of_investment string
180
}
181 1 Ryan Supawarapong
182 5 Ryan Supawarapong
Table thaid {
183 1 Ryan Supawarapong
  id int
184 5 Ryan Supawarapong
  url string
185
  state string
186
  thaid_detail_id int [ref: - thaid_detail.id]
187 1 Ryan Supawarapong
}
188
189 5 Ryan Supawarapong
Table ndid {
190 1 Ryan Supawarapong
  id int
191 5 Ryan Supawarapong
  ndid_detail_id int [ref: - ndid_detail.id]
192 1 Ryan Supawarapong
}
193
194 5 Ryan Supawarapong
Table approval {
195 1 Ryan Supawarapong
  id int
196 5 Ryan Supawarapong
  by string
197
  name string
198
  level int
199
  message string
200
  is_approve bool
201 1 Ryan Supawarapong
}
202
203 5 Ryan Supawarapong
Table risk_score {
204 1 Ryan Supawarapong
  id int
205 5 Ryan Supawarapong
  score int
206
  risk_level int
207
}
208
209
Table asset_detail {
210
  id int
211 2 Ryan Supawarapong
  name string
212 5 Ryan Supawarapong
  price float
213 2 Ryan Supawarapong
}
214
215
// ----------------------
216 5 Ryan Supawarapong
// Layer 3
217
// ----------------------
218 2 Ryan Supawarapong
219 5 Ryan Supawarapong
Table suitability_question {
220
  id int
221
  question string
222 2 Ryan Supawarapong
}
223
224 5 Ryan Supawarapong
Table suitability_choice {
225
  id int 
226
  question_id int [ref: > suitability_question.id]
227
  answer string
228
  score int
229
}
230
231
Table appman_id_card {
232 2 Ryan Supawarapong
  id int
233 7 Ryan Supawarapong
  register_id string
234
  verification_id string
235
  id_number string
236
  address_th string
237
  full_name_th string
238
  full_name_en string
239
  serial_number string
240
  date_birth_en string
241
  date_birth_th string
242
  date_issue_en string
243
  date_issue_th string
244
  date_expire_en string
245
  date_expire_th string
246
  laser_code string
247
  updated_at timestamp
248 5 Ryan Supawarapong
}
249 2 Ryan Supawarapong
250 1 Ryan Supawarapong
Table appman_liveness {
251 7 Ryan Supawarapong
  id int [pk, increment]
252
  register_id string
253
  verification_id string
254
  verified bool
255
  valid bool
256
  completed bool
257
  success bool
258
  was_processed bool
259
  scan_result_blob text
260
  updated_at timestamp
261 2 Ryan Supawarapong
}
262 5 Ryan Supawarapong
263 2 Ryan Supawarapong
Table appman_liveness_attributes {
264 1 Ryan Supawarapong
  id int
265 7 Ryan Supawarapong
  register_id string
266
  verification_id string
267
  yaw float
268
  roll float
269
  pitch float
270
  is_beard bool
271
  beard_confidence float
272
  is_smile bool
273
  smile_confidence float
274
  gender string
275
  gender_confidence float
276
  sharpness float
277
  brightness float
278
  age_low int
279
  age_high int
280
  is_eyes_open bool
281
  eyes_open_confidence float
282
  is_mustache bool
283
  mustache_confidence float
284
  is_mouth_open bool
285
  mouth_open_confidence float
286
  confidence float
287
  is_eyeglasses bool
288
  eyeglasses_confidence float
289
  is_sunglasses bool
290
  sunglasses_confidence float
291 5 Ryan Supawarapong
}
292
293
Table appman_recognition {
294 1 Ryan Supawarapong
  id int
295 7 Ryan Supawarapong
  register_id string
296
  verification_id string
297
  yaw float
298
  roll float
299
  pitch float
300
  sharpness float
301
  brightness float
302
  top float
303
  left float
304
  width float
305
  height float
306
  similarity float
307
  pass_similarity bool
308
  confidence float
309
  verified bool
310
  valid bool
311
  completed bool
312
  source_key string
313
  target_key string
314
  source_url string
315
  target_url string
316
  updated_at timestamp
317 5 Ryan Supawarapong
}
318
Table education {
319
  id int
320
  code string
321
  name string
322
}
323
324
Table business_type {
325
  id int
326
  name string
327
  risk_score int
328
}
329
330
Table income_range {
331
  id int
332
  range string
333
}
334
335
Table thaid_detail {
336
  id int
337
}
338
339
Table ndid_detail {
340
  id int
341
}
342
343
Table ip_detail {
344
  id int
345
  ip_address string
346
  country string
347
}
348
349
Table title {
350
  id int
351
  name_en string
352
  name_th string
353
}
354
355
356 6 Ryan Supawarapong
```
357 5 Ryan Supawarapong
358 1 Ryan Supawarapong
359 6 Ryan Supawarapong
Tree layer version:
360
```
361
.
362
├── Layer 1
363
│   ├── onboarding
364
│   │   ├── id: int
365
│   │   ├── register_id: uuid
366
│   │   ├── customer_info_id: int [ref: customer_info.id]
367
│   │   ├── idcard_id: int [ref: idcard.id]
368
│   │   ├── occupation_id: int [ref: occupation.id]
369
│   │   ├── register_address_id: int [ref: address.id]
370
│   │   ├── current_address_id: int [ref: address.id]
371
│   │   ├── work_address_id: int [ref: address.id]
372
│   │   ├── customer_suite_id: int [ref: customer_suite_submission.id]
373
│   │   ├── cdd_id: int [ref: cdd.id]
374
│   │   ├── bank_id: int [ref: bank.id]
375
│   │   ├── secondary_bank_id: int [ref: bank.id]
376
│   │   ├── source_of_fund_id: int [ref: source_of_fund.id]
377
│   │   ├── thaid_id: int [ref: thaid.id]
378
│   │   ├── ndid_id: int [ref: ndid.id]
379
│   │   ├── approval_id: int [ref: approval.id]
380
│   │   ├── appman_id: int [ref: appman.id]
381
│   │   ├── risk_score_id: int [ref: risk_score.id]
382
│   │   ├── has_done_knowledge_test: bool
383
│   │   └── steps: int
384
│   ├── customer
385
│   │   ├── id: int
386
│   │   ├── customer_info_id: int [ref: customer_info.id]
387
│   │   ├── risk_score_id: int [ref: risk_score.id]
388
│   │   ├── idcard_id: int [ref: idcard.id]
389
│   │   ├── occupation_id: int [ref: occupation.id]
390
│   │   ├── register_address_id: int [ref: address.id]
391
│   │   ├── current_address_id: int [ref: address.id]
392
│   │   ├── work_address_id: int [ref: address.id]
393
│   │   ├── customer_suite_id: int [ref: customer_suite_submission.id]
394
│   │   ├── bank_id: int [ref: bank.id]
395
│   │   ├── secondary_bank_id: int [ref: bank.id]
396
│   │   └── source_of_fund_id: int [ref: source_of_fund.id]
397
│   ├── transaction
398
│   │   ├── id: uuid
399
│   │   └── seller_info_id: int [ref: customer_info.id]
400 8 Ryan Supawarapong
│   │   └── buyer_info_id: int [ref: - customer_info.id]
401
│   │   └── price: float
402
│   │   └── amount_per_unit: float
403
│   │   └── unit: float
404 6 Ryan Supawarapong
│   └── digital_asset
405
│       ├── id: uuid
406
│       ├── customer_info_id: int [ref: customer_info.id]
407
│       └── asset_detail_id: int [ref: asset_detail.id]
408
├── Layer 2
409
│   ├── customer_info
410
│   │   ├── id: int
411
│   │   ├── mobile: string
412
│   │   ├── email: string
413
│   │   ├── title_id: int [ref: title.id]
414
│   │   ├── first_name_th: string
415
│   │   ├── middle_name_th: string
416
│   │   ├── last_name_th: string
417
│   │   ├── first_name_en: string
418
│   │   ├── middle_name_en: string
419
│   │   ├── last_name_en: string
420
│   │   ├── customer_type: enum
421
│   │   └── ip_id: int [ref: ip_detail.id]
422
│   ├── address
423
│   │   ├── id: int
424
│   │   ├── house_number: string
425
│   │   ├── floor: string
426
│   │   ├── village_building: string
427
│   │   ├── sub_street: string
428
│   │   ├── street: string
429
│   │   ├── country_code: string
430
│   │   └── location_id: int
431
│   ├── idcard
432
│   │   ├── id: int
433
│   │   ├── citizen_id: string
434
│   │   ├── laser_code: string
435
│   │   ├── date_of_birth: timestamp
436
│   │   ├── expire_date: timestamp
437
│   │   └── issue_date: timestamp
438
│   ├── occupation
439
│   │   ├── id: int
440
│   │   ├── code: string
441
│   │   ├── position_name: string
442
│   │   ├── source_of_investment: string
443
│   │   ├── workplace_name: string
444
│   │   ├── education_id: string [ref: education.id]
445
│   │   ├── occupation_id: int [ref: occupation.id]
446
│   │   ├── business_type_id: int [ref: business_type.id]
447
│   │   └── income_range_id: int [ref: income_range.id]
448
│   ├── customer_suite_answer
449
│   │   ├── id: int
450
│   │   ├── submission_id: int [ref: customer_suite_submission.id]
451
│   │   ├── question_id: int [ref: suitability_question.id]
452
│   │   └── choice_id: int [ref: suitability_choice.id]
453
│   ├── customer_suite_submission
454
│   │   ├── id: int
455
│   │   ├── customer_info_id: int [ref: customer_info.id]
456
│   │   ├── total_score: int
457
│   │   └── risk_level: string
458
│   ├── cdd
459
│   │   ├── id: int
460
│   │   ├── mule: string
461
│   │   ├── freeze_04: string
462
│   │   ├── freeze_05: string
463
│   │   ├── pep: bool
464
│   │   ├── pep_message: string
465
│   │   └── dopa: bool
466
│   ├── appman
467
│   │   ├── id: int
468
│   │   ├── verification_id: string
469
│   │   ├── idcard_id: int [ref: appman_id_card.id]
470
│   │   ├── liveness_id: int [ref: appman_liveness.id]
471
│   │   ├── liveness_attribute_id: int [ref: appman_liveness_attributes.id]
472
│   │   └── recognition: int [ref: appman_recognition.id]
473
│   ├── bank
474
│   │   ├── id: int
475
│   │   ├── name: string
476
│   │   ├── branch: string
477
│   │   └── account_no: string
478
│   ├── source_of_fund
479
│   │   ├── id: int
480
│   │   ├── source_of_fund: string
481
│   │   ├── country_of_income: string
482
│   │   └── purpose_of_investment: string
483
│   ├── thaid
484
│   │   ├── id: int
485
│   │   ├── url: string
486
│   │   ├── state: string
487
│   │   └── thaid_detail_id: int [ref: thaid_detail.id]
488
│   ├── ndid
489
│   │   ├── id: int
490
│   │   └── ndid_detail_id: int [ref: ndid_detail.id]
491
│   ├── approval
492
│   │   ├── id: int
493
│   │   ├── by: string
494
│   │   ├── name: string
495
│   │   ├── level: int
496
│   │   ├── message: string
497
│   │   └── is_approve: bool
498
│   ├── risk_score
499
│   │   ├── id: int
500
│   │   ├── score: int
501
│   │   └── risk_level: int
502
│   └── asset_detail
503
│       ├── id: int
504
│       ├── name: string
505
│       └── price: float
506
└── Layer 3
507
    ├── suitability_question
508
    │   ├── id: int
509
    │   └── question: string
510
    ├── suitability_choice
511 1 Ryan Supawarapong
    │   ├── id: int
512
    │   ├── question_id: int [ref: suitability_question.id]
513
    │   ├── answer: string
514
    │   └── score: int
515
    ├── appman_id_card
516 7 Ryan Supawarapong
    │   ├── id: int
517
    │   ├── register_id: string
518
    │   ├── verification_id: string
519
    │   ├── id_number: string
520
    │   ├── address_th: string
521
    │   ├── full_name_th: string
522
    │   ├── full_name_en: string
523
    │   ├── serial_number: string
524
    │   ├── date_birth_en: string
525
    │   ├── date_birth_th: string
526
    │   ├── date_issue_en: string
527
    │   ├── date_issue_th: string
528
    │   ├── date_expire_en: string
529
    │   ├── date_expire_th: string
530
    │   ├── laser_code: string
531
    │   └── updated_at: timestamp
532 1 Ryan Supawarapong
    ├── appman_liveness
533 7 Ryan Supawarapong
    │   ├── id: int [pk, increment]
534
    │   ├── register_id: string
535
    │   ├── verification_id: string
536
    │   ├── verified: bool
537
    │   ├── valid: bool
538
    │   ├── completed: bool
539
    │   ├── success: bool
540
    │   ├── was_processed: bool
541
    │   ├── scan_result_blob: text
542
    │   └── updated_at: timestamp
543 1 Ryan Supawarapong
    ├── appman_liveness_attributes
544 7 Ryan Supawarapong
    │   ├── id: int
545
    │   ├── register_id: string
546
    │   ├── verification_id: string
547
    │   ├── yaw: float
548
    │   ├── roll: float
549
    │   ├── pitch: float
550
    │   ├── is_beard: bool
551
    │   ├── beard_confidence: float
552
    │   ├── is_smile: bool
553
    │   ├── smile_confidence: float
554
    │   ├── gender: string
555
    │   ├── gender_confidence: float
556
    │   ├── sharpness: float
557
    │   ├── brightness: float
558
    │   ├── age_low: int
559
    │   ├── age_high: int
560
    │   ├── is_eyes_open: bool
561
    │   ├── eyes_open_confidence: float
562
    │   ├── is_mustache: bool
563
    │   ├── mustache_confidence: float
564
    │   ├── is_mouth_open: bool
565
    │   ├── mouth_open_confidence: float
566
    │   ├── confidence: float
567
    │   ├── is_eyeglasses: bool
568
    │   ├── eyeglasses_confidence: float
569
    │   ├── is_sunglasses: bool
570
    │   └── sunglasses_confidence: float
571 1 Ryan Supawarapong
    ├── appman_recognition
572 7 Ryan Supawarapong
    │   ├── id: int
573
    │   ├── register_id: string
574
    │   ├── verification_id: string
575
    │   ├── yaw: float
576
    │   ├── roll: float
577
    │   ├── pitch: float
578
    │   ├── sharpness: float
579
    │   ├── brightness: float
580
    │   ├── top: float
581
    │   ├── left: float
582
    │   ├── width: float
583
    │   ├── height: float
584
    │   ├── similarity: float
585
    │   ├── pass_similarity: bool
586
    │   ├── confidence: float
587
    │   ├── verified: bool
588
    │   ├── valid: bool
589
    │   ├── completed: bool
590
    │   ├── source_key: string
591
    │   ├── target_key: string
592
    │   ├── source_url: string
593
    │   ├── target_url: string
594
    │   └── updated_at: timestamp
595 6 Ryan Supawarapong
    ├── education
596
    │   ├── id: int
597
    │   ├── code: string
598
    │   └── name: string
599
    ├── business_type
600
    │   ├── id: int
601
    │   ├── name: string
602
    │   └── risk_score: int
603
    ├── income_range
604
    │   ├── id: int
605
    │   └── range: string
606
    ├── thaid_detail
607
    │   └── id: int
608
    ├── ndid_detail
609
    │   └── id: int
610
    ├── ip_detail
611
    │   ├── id: int
612
    │   ├── ip_address: string
613
    │   └── country: string
614
    └── title
615
        ├── id: int
616
        ├── name_en: string
617
        └── name_th: string
618 1 Ryan Supawarapong
```