#okNextError No query
CREATE TABLE "congregationmeetingtimes" (id integer not null primary key, "congregation_id" int NOT NULL , "mtg_year" int NOT NULL , "mtg_day" int NOT NULL , "mtg_time" varchar(20) NOT NULL , time_stamp INT DEFAULT 0)
#updateMeetingTimes
update congregationmeetingtimes set mtg_time = ifnull((select meeting2_time from congregations c where congregationmeetingtimes.congregation_id = c.id), '')
update congregationmeetingtimes set mtg_day = ifnull((select value from settings where name = 'publicmeeting_day'), mtg_day) where congregation_id = (select value from settings where name = 'congregation_id')
delete from settings where name = 'publicmeeting_day'
CREATE TABLE congregations_temp(id INTEGER PRIMARY KEY, name VARCHAR(255), address VARCHAR(255), meeting1_time VARCHAR(255), circuit VARCHAR(255), info VARCHAR(255), time_stamp INT DEFAULT 0, active BOOLEAN DEFAULT 1, uuid TEXT)
insert into congregations_temp(id, name, address, meeting1_time, circuit, info, time_stamp, active, uuid) select id, name, address, meeting1_time, circuit, info, time_stamp, active, uuid from congregations
drop table congregations
alter table congregations_temp rename to congregations
drop view if exists publicmeetinghistory 
create view publicmeetinghistory as SELECT m.date as weekof, date(m.date, (ifnull(cmt.mtg_day, 7) - 1) || ' day') as mtg_date, m.theme_number as theme_id, pt.theme_name as theme, m.speaker_id as speaker_id, m.chairman_id as chairman_id, m.wtreader_id as wtreader_id, m.wt_conductor_id FROM publicmeeting m LEFT JOIN publictalks pt ON m.theme_number = pt.theme_number AND pt.lang_id =     (SELECT id FROM languages WHERE code = (SELECT value FROM settings WHERE name = 'theocbase_language') ) LEFT JOIN congregationmeetingtimes cmt on cmt.congregation_id = (SELECT value FROM settings WHERE name = 'congregation_id') and strftime('%Y', m.date) = cmt.mtg_year
ALTER TABLE exceptions ADD COLUMN cbsday INT DEFAULT NULL
