You can't put a table constraint before the end of the columns definitions like that. You need to write this
db.execute <<__SQL__
CREATE TABLE IF NOT EXISTS AIRED (
programCode INTEGER,
fromDate INTEGER,
toDate INTEGER,
program TEXT,
channel TEXT,
weekday TEXT,
startTime TEXT,
endTime TEXT,
duration TEXT,
PRIMARY KEY (programCode, fromDate, toDate)
)
__SQL__