-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script for testing TAP_SCHEMA in MySQL
- Loading branch information
1 parent
bf7240d
commit de125b7
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/bash | ||
|
||
# Check if FELIS_ENGINE_URL is set | ||
if [ -z "$FELIS_ENGINE_URL" ]; then | ||
echo "Error: FELIS_ENGINE_URL is not set. Please set the environment variable and try again." | ||
exit 1 | ||
fi | ||
|
||
# Initialize a variable to track if any command fails | ||
error_occurred=0 | ||
|
||
for yaml_file in yml/*.yaml; do | ||
filename=$(basename "$yaml_file") | ||
echo "Uploading to TAP_SCHEMA from $yaml_file..." | ||
felis --log-level ERROR load-tap --engine-url ${FELIS_ENGINE_URL}/TAP_SCHEMA "$yaml_file" | ||
# Check if the felis command was successful | ||
if [ $? -ne 0 ]; then | ||
echo "Error: Failed to create SQL from $file" | ||
error_occurred=1 | ||
else | ||
echo "Done creating SQL from $yaml_file" | ||
fi | ||
mysql -DTAP_SCHEMA -e " | ||
DELETE FROM \`columns\`; | ||
DELETE FROM \`key_columns\`; | ||
DELETE FROM \`keys\`; | ||
DELETE FROM \`schemas\`; | ||
DELETE FROM \`tables\`; | ||
" | ||
done | ||
|
||
# Exit with non-zero status if any command failed | ||
if [ $error_occurred -ne 0 ]; then | ||
echo "Error: Failed to load all schemas into TAP_SCHEMA" | ||
exit 1 | ||
fi |