CREATE TABLE IF NOT EXISTS Locations ( id TEXT NOT NULL, name TEXT NOT NULL, description TEXT, PRIMARY KEY(id) ); CREATE TABLE IF NOT EXISTS Series ( id TEXT NOT NULL, name TEXT NOT NULL, description TEXT, PRIMARY KEY(id) ); CREATE TABLE IF NOT EXISTS Sessions ( id TEXT NOT NULL, name TEXT NOT NULL, start INTEGER NOT NULL, duration_minutes INTEGER NOT NULL, location TEXT, location_name TEXT, series TEXT NOT NULL, series_name TEXT NOT NULL, PRIMARY KEY(id), FOREIGN KEY(location) REFERENCES locations(id) ON DELETE CASCADE ); CREATE TABLE IF NOT EXISTS Events ( id TEXT NOT NULL, start_date TEXT NOT NULL, end_date TEXT, description TEXT NOT NULL, series TEXT NOT NULL, series_name TEXT NOT NULL, location TEXT, location_name TEXT, FOREIGN KEY(location) REFERENCES locations(id) ON DELETE CASCADE, PRIMARY KEY(id), FOREIGN KEY(series) REFERENCES series(id) ON DELETE CASCADE ); CREATE TABLE IF NOT EXISTS Updates ( window_start INTEGER NOT NULL, time INTEGER NOT NULL, date TEXT, PRIMARY KEY(window_start) );