Thank you so much for your help! It worked!!!

I created a script that exports all the tables from my schema, and based on 
that, I created a script that runs the ALTER TABLE commands for all the 
exported tables.

All the best,
Bogdan

PS: For anyone else who needs a few more details:

The sql to export my tables is :
CALL CSVWRITE('./schema/public_tables.csv', 'SELECT TABLE_NAME FROM 
INFORMATION_SCHEMA.TABLES WHERE 
TABLE_SCHEMA=''PUBLIC''','writeColumnHeader=false fieldDelimiter=');

The bash script that creates the check script is:

tables_csv_file=./schema/public_tables.csv
check_consistency_sql_file=./schema/check_consistency.sql

echo Starting to write 
check_consistency_sql_file=$check_consistency_sql_file
rm "$check_consistency_sql_file"
while read table_name; do
  echo "ALTER TABLE $table_name SET REFERENTIAL_INTEGRITY TRUE 
CHECK;">>$check_consistency_sql_file
done <$tables_csv_file
echo Finished writing check_consistency_sql_file


PPS: I think it would have been better to generate the sql check script 
file directly with the CSVWRITE command, but I didn't want to spend more 
time on this.


-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/h2-database/cf47d7d7-04b4-4a24-afc4-fa38823ba87fn%40googlegroups.com.

Reply via email to