Project

General

Profile

Actions

How to clear database

-- =============================================================================
-- Database Cleanup Script - Truncate All Tables
-- Generated: 2026-02-13
-- =============================================================================
-- This script will truncate all tables across multiple databases
-- WARNING: This will delete all data from the specified tables!
-- =============================================================================

-- Begin transaction to ensure atomicity
START TRANSACTION;

-- Disable foreign key checks to allow truncation without constraint errors
SET FOREIGN_KEY_CHECKS = 0;

-- =============================================================================
-- Database: banks
-- =============================================================================
USE banks;

TRUNCATE TABLE bill_payment_informations;
TRUNCATE TABLE biller_informations;
TRUNCATE TABLE bot_qrs;
TRUNCATE TABLE confirmations;
TRUNCATE TABLE initiations;
TRUNCATE TABLE inquirys;
TRUNCATE TABLE items;
TRUNCATE TABLE payer_informations;
TRUNCATE TABLE payment_verification_criterias;
TRUNCATE TABLE post_initiations;
TRUNCATE TABLE reversals;
TRUNCATE TABLE withholding_tax_information_items;

-- =============================================================================
-- Database: corporates
-- =============================================================================
USE corporates;

TRUNCATE TABLE addresses;
TRUNCATE TABLE answers;
TRUNCATE TABLE bank_transactions;
TRUNCATE TABLE banks;
TRUNCATE TABLE business_types;
TRUNCATE TABLE contacts;
TRUNCATE TABLE corporate_accounts;
TRUNCATE TABLE corporate_countries;
TRUNCATE TABLE corporate_financials;
TRUNCATE TABLE corporate_infos;
TRUNCATE TABLE corporate_tokens;
TRUNCATE TABLE corporate_types;
TRUNCATE TABLE corporates;
TRUNCATE TABLE country_source_incomes;
TRUNCATE TABLE customer_addresses;
TRUNCATE TABLE customer_bookbanks;
TRUNCATE TABLE customer_informations;
TRUNCATE TABLE customer_investment_occupations;
TRUNCATE TABLE customer_tokens;
TRUNCATE TABLE customers;
TRUNCATE TABLE documents;
TRUNCATE TABLE exchange_rates;
TRUNCATE TABLE fatca_knowledges;
TRUNCATE TABLE full_names;
TRUNCATE TABLE juristics;
TRUNCATE TABLE personals;
TRUNCATE TABLE source_of_incomes;
TRUNCATE TABLE suit_test_results;
TRUNCATE TABLE transactions;

-- =============================================================================
-- Database: customers
-- =============================================================================
USE customers;

TRUNCATE TABLE addresses;
TRUNCATE TABLE addresses_history;
TRUNCATE TABLE answers;
TRUNCATE TABLE answers_history;
TRUNCATE TABLE apipayments;
TRUNCATE TABLE apithb_details;
TRUNCATE TABLE apithb_headers;
TRUNCATE TABLE apithb_trailers;
TRUNCATE TABLE appman;
TRUNCATE TABLE appman_idcard;
TRUNCATE TABLE appman_liveness;
TRUNCATE TABLE appman_liveness_attributes;
TRUNCATE TABLE appman_recognition;
TRUNCATE TABLE b_payment_details;
TRUNCATE TABLE b_payment_headers;
TRUNCATE TABLE b_payment_trailers;
TRUNCATE TABLE balances;
TRUNCATE TABLE bank_transactions;
TRUNCATE TABLE bookbanks;
TRUNCATE TABLE bookbanks_history;
TRUNCATE TABLE bpm_report_details;
TRUNCATE TABLE bpm_report_headers;
TRUNCATE TABLE bpm_report_trailers;
TRUNCATE TABLE contact_us;
TRUNCATE TABLE customer_accounts;
TRUNCATE TABLE customer_accounts_history;
TRUNCATE TABLE customer_tokens;
TRUNCATE TABLE documents;
TRUNCATE TABLE documents_history;
TRUNCATE TABLE email_verifies;
TRUNCATE TABLE face_landmarks;
TRUNCATE TABLE facecompares;
TRUNCATE TABLE fatca_knowledges;
TRUNCATE TABLE fatca_knowledges_history;
TRUNCATE TABLE fatca_w8s;
TRUNCATE TABLE fatca_w8s_history;
TRUNCATE TABLE fatca_w9s;
TRUNCATE TABLE fatca_w9s_history;
TRUNCATE TABLE informations;
TRUNCATE TABLE informations_history;
TRUNCATE TABLE investment_occupations;
TRUNCATE TABLE investment_occupations_history;
TRUNCATE TABLE investor_types;
TRUNCATE TABLE investor_types_history;
TRUNCATE TABLE livenesses;
TRUNCATE TABLE mobile_verifies;
TRUNCATE TABLE password_history;
TRUNCATE TABLE pep_watchlist;
TRUNCATE TABLE refund;
TRUNCATE TABLE review_kyc_history;
TRUNCATE TABLE risk_groups;
TRUNCATE TABLE suit_test_results;
TRUNCATE TABLE suit_test_results_history;
TRUNCATE TABLE thaid_infos;
TRUNCATE TABLE thaid_logs;
TRUNCATE TABLE thaiqr;
TRUNCATE TABLE totps;
TRUNCATE TABLE transactions;

-- =============================================================================
-- Database: icos
-- =============================================================================
USE icos;

TRUNCATE TABLE addresses;
TRUNCATE TABLE assets;
TRUNCATE TABLE company_members;
TRUNCATE TABLE details;
TRUNCATE TABLE documents;
TRUNCATE TABLE faqs;
TRUNCATE TABLE icos;
TRUNCATE TABLE infos;
TRUNCATE TABLE invests;
TRUNCATE TABLE invoices;
TRUNCATE TABLE issuance_terms;
TRUNCATE TABLE issuer_infos;
TRUNCATE TABLE key_informations;
TRUNCATE TABLE token_details;

-- =============================================================================
-- Database: paymentapis
-- =============================================================================
USE paymentapis;

TRUNCATE TABLE withholding_tax_informations;

-- =============================================================================
-- Re-enable foreign key checks
-- =============================================================================
SET FOREIGN_KEY_CHECKS = 1;

-- =============================================================================
-- Summary:
-- - Total databases: 5
-- - Total tables truncated: 153
-- =============================================================================

-- NOTE: Review the changes before committing. Ensure that you have backups if necessary.
-- Commit transaction to finalize changes,
-- COMMIT;
-- Rollback transaction if needed,
-- ROLLBACK;

Updated by Ryan Supawarapong about 20 hours ago · 1 revisions