1.4 KiB
1.4 KiB
CheckDB Function Documentation
Overview
The CheckDB function is a JavaScript function that checks the integrity of a database by performing CRC32 checksum calculations on specified columns in specified tables. It returns a Promise that resolves to true if the operation is successful, and rejects with an error if there's any issue during the process.
Description
The function performs the following steps:
- Reads configuration from
../args/config.json. - Initializes a database connection using the provided configuration.
- Reads data structure from
../src/data_structure.json. - Constructs a checksum query for specified columns.
- Retrieves a list of tables from the database.
- Performs checksum calculations on each table using the constructed query.
- Logs the results in a tabular format.
- Resolves the Promise with
trueif the operation is successful.
Notes
- Make sure the necessary configuration files (
config.jsonanddata_structure.json) are present in the specified paths. - The function uses promises for asynchronous operations. Handle the resolved and rejected states accordingly in your code.
- Ensure proper error handling and logging for production use.
Feel free to modify the function according to your specific requirements.
Note: This documentation assumes that the necessary dependencies (Database and related functions) are properly imported and available in the codebase.