Sorry, I edited my answer not realizing you had answered me (I have a bad habit of doing that as I am on a different time sone than most reddit users so most of the time its ok).
My advice is to handle the check of you have the correct columns in your script by using SELECT name FROM pagma_table_info('TABLENAME');
(makes it easier to create the new columns).
If its ok to stop the execution (as opposed to creating the missing column and continue) I think you can create a trigger on insert to the table, which check if the columns are there.
1
u/Individual_Ad583 May 02 '23
Unfortunately, CASE expressions won't work. Tried it.
When using CASE, we have columns that don't exist causing the script to fail with column not found.
I want something like stopping execution the scrip gracefully if the pragma_table_info/sqlite_master table doesn't have the column I want.