Project

General

Profile

How to clear database » History » Version 4

pasin sadsara, 05/19/2026 06:18 AM

1 1 Ryan Supawarapong
-- Begin transaction to ensure atomicity
2
START TRANSACTION;
3
4
-- Disable foreign key checks to allow truncation without constraint errors
5
SET FOREIGN_KEY_CHECKS = 0;
6
7
-- =============================================================================
8
-- Database: banks
9
-- =============================================================================
10
USE banks;
11
12
TRUNCATE TABLE bill_payment_informations;
13
TRUNCATE TABLE biller_informations;
14
TRUNCATE TABLE bot_qrs;
15
TRUNCATE TABLE confirmations;
16
TRUNCATE TABLE initiations;
17
TRUNCATE TABLE inquirys;
18
TRUNCATE TABLE items;
19
TRUNCATE TABLE payer_informations;
20
TRUNCATE TABLE payment_verification_criterias;
21
TRUNCATE TABLE post_initiations;
22
TRUNCATE TABLE reversals;
23
TRUNCATE TABLE withholding_tax_information_items;
24
25
-- =============================================================================
26
-- Database: corporates
27
-- =============================================================================
28
USE corporates;
29
30
TRUNCATE TABLE addresses;
31
TRUNCATE TABLE answers;
32 4 pasin sadsara
TRUNCATE TABLE approval_logs;
33 1 Ryan Supawarapong
TRUNCATE TABLE bank_transactions;
34
TRUNCATE TABLE banks;
35
TRUNCATE TABLE business_types;
36
TRUNCATE TABLE contacts;
37
TRUNCATE TABLE corporate_accounts;
38
TRUNCATE TABLE corporate_countries;
39
TRUNCATE TABLE corporate_financials;
40
TRUNCATE TABLE corporate_infos;
41
TRUNCATE TABLE corporate_tokens;
42
TRUNCATE TABLE corporate_types;
43
TRUNCATE TABLE corporates;
44
TRUNCATE TABLE country_source_incomes;
45
TRUNCATE TABLE documents;
46
TRUNCATE TABLE exchange_rates;
47
TRUNCATE TABLE fatca_knowledges;
48
TRUNCATE TABLE full_names;
49
TRUNCATE TABLE juristics;
50
TRUNCATE TABLE personals;
51 4 pasin sadsara
TRUNCATE TABLE personal_cdd_checks;
52 1 Ryan Supawarapong
TRUNCATE TABLE source_of_incomes;
53
TRUNCATE TABLE suit_test_results;
54
TRUNCATE TABLE transactions;
55 4 pasin sadsara
TRUNCATE TABLE totps;
56 1 Ryan Supawarapong
57
-- =============================================================================
58
-- Database: customers
59
-- =============================================================================
60
USE customers;
61
62
TRUNCATE TABLE addresses;
63
TRUNCATE TABLE addresses_history;
64
TRUNCATE TABLE answers;
65
TRUNCATE TABLE answers_history;
66
TRUNCATE TABLE apipayments;
67
TRUNCATE TABLE apithb_details;
68
TRUNCATE TABLE apithb_headers;
69
TRUNCATE TABLE apithb_trailers;
70
TRUNCATE TABLE appman;
71
TRUNCATE TABLE appman_idcard;
72
TRUNCATE TABLE appman_liveness;
73
TRUNCATE TABLE appman_liveness_attributes;
74
TRUNCATE TABLE appman_recognition;
75
TRUNCATE TABLE b_payment_details;
76
TRUNCATE TABLE b_payment_headers;
77
TRUNCATE TABLE b_payment_trailers;
78
TRUNCATE TABLE balances;
79
TRUNCATE TABLE bank_transactions;
80
TRUNCATE TABLE bookbanks;
81
TRUNCATE TABLE bookbanks_history;
82
TRUNCATE TABLE contact_us;
83
TRUNCATE TABLE customer_accounts;
84
TRUNCATE TABLE customer_accounts_history;
85
TRUNCATE TABLE customer_tokens;
86
TRUNCATE TABLE documents;
87
TRUNCATE TABLE documents_history;
88
TRUNCATE TABLE email_verifies;
89
TRUNCATE TABLE face_landmarks;
90
TRUNCATE TABLE facecompares;
91
TRUNCATE TABLE fatca_knowledges;
92
TRUNCATE TABLE fatca_knowledges_history;
93
TRUNCATE TABLE fatca_w8s;
94
TRUNCATE TABLE fatca_w8s_history;
95
TRUNCATE TABLE fatca_w9s;
96
TRUNCATE TABLE fatca_w9s_history;
97
TRUNCATE TABLE informations;
98
TRUNCATE TABLE informations_history;
99
TRUNCATE TABLE investment_occupations;
100
TRUNCATE TABLE investment_occupations_history;
101
TRUNCATE TABLE investor_types;
102
TRUNCATE TABLE investor_types_history;
103
TRUNCATE TABLE livenesses;
104
TRUNCATE TABLE mobile_verifies;
105
TRUNCATE TABLE password_history;
106
TRUNCATE TABLE pep_watchlist;
107
TRUNCATE TABLE refund;
108 2 Ryan Supawarapong
TRUNCATE TABLE re_kyc_fatca_knowledge;
109
TRUNCATE TABLE re_kyc_informations;
110
TRUNCATE TABLE re_kyc_suite_test_answers;
111
TRUNCATE TABLE re_kyc_suite_tests;
112
TRUNCATE TABLE re_kyc_w8;
113
TRUNCATE TABLE re_kyc_w9;
114 1 Ryan Supawarapong
TRUNCATE TABLE review_kyc_history;
115
TRUNCATE TABLE risk_groups;
116
TRUNCATE TABLE suit_test_results;
117
TRUNCATE TABLE suit_test_results_history;
118
TRUNCATE TABLE thaid_infos;
119
TRUNCATE TABLE thaid_logs;
120
TRUNCATE TABLE thaiqr;
121
TRUNCATE TABLE totps;
122
TRUNCATE TABLE transactions;
123
124
-- =============================================================================
125
-- Database: icos
126
-- =============================================================================
127
USE icos;
128
129
TRUNCATE TABLE addresses;
130 3 pasin sadsara
TRUNCATE TABLE approver_dbs;
131 1 Ryan Supawarapong
TRUNCATE TABLE assets;
132
TRUNCATE TABLE company_members;
133 3 pasin sadsara
TRUNCATE TABLE confirmations;
134 1 Ryan Supawarapong
TRUNCATE TABLE details;
135
TRUNCATE TABLE documents;
136 3 pasin sadsara
TRUNCATE TABLE email_logs;
137 1 Ryan Supawarapong
TRUNCATE TABLE faqs;
138
TRUNCATE TABLE icos;
139
TRUNCATE TABLE infos;
140
TRUNCATE TABLE invests;
141
TRUNCATE TABLE invoices;
142
TRUNCATE TABLE issuance_terms;
143
TRUNCATE TABLE issuer_infos;
144
TRUNCATE TABLE key_informations;
145
TRUNCATE TABLE token_details;
146 3 pasin sadsara
TRUNCATE TABLE portfolios;
147
TRUNCATE TABLE transactions;
148
TRUNCATE TABLE registrars;
149
TRUNCATE TABLE payments;
150 1 Ryan Supawarapong
151 3 pasin sadsara
152 1 Ryan Supawarapong
-- =============================================================================
153
-- Database: paymentapis
154
-- =============================================================================
155
USE paymentapis;
156
157
TRUNCATE TABLE withholding_tax_informations;
158
159
-- =============================================================================
160
-- Re-enable foreign key checks
161
-- =============================================================================
162
SET FOREIGN_KEY_CHECKS = 1;
163
164
-- =============================================================================
165
-- Summary:
166
-- - Total databases: 5
167
-- - Total tables truncated: 153
168
-- =============================================================================
169
170
-- NOTE: Review the changes before committing. Ensure that you have backups if necessary.
171
-- Commit transaction to finalize changes,
172
-- COMMIT;
173
-- Rollback transaction if needed,
174
-- ROLLBACK;