Turns out you can't introduce a new UNIQUE
constraint on an existing table that already has a UNIQUE
constraint.
This is a problem for Jacaranda, because this is the old schema prior to merging #8:
CREATE TABLE data (date_posted,text,runner,UNIQUE (date_posted))
And this is the new schema created from a dry run of #8, now there are multiple runners:
CREATE TABLE data (date_posted,text,runner,UNIQUE (date_posted,runner))
SQLite doesn't support adding new columns with UNIQUE
or PRIMARY KEY
constraints to existing tables.
SQLite does permit adding a unique index if your table has no existing UNIQUE
constraints.
The effect of this is:
when we run the scraper, only one runner is able to record that it successfully ran, because there is a single primary key: runner
This means that when the scraper gets run by Morph, it will post messages to Slack every day, because it doesn't know that the runner successfully ran the day before.