Project

General

Profile

How to clear database » History » Version 3

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