add REFRESH_ERROR to the status of subscriptions and add a new column refreshed_at

This commit is contained in:
Hongbo Wu 2024-01-24 11:26:35 +08:00
parent 1550a43b81
commit 9e966bb269
2 changed files with 32 additions and 0 deletions

View file

@ -0,0 +1,19 @@
-- Type: DO
-- Name: alter_subscriptions
-- Description: Alter omnivore.subscriptions table to add a new state and date column
BEGIN;
ALTER TYPE subscription_status_type
ADD VALUE IF NOT EXISTS 'REFRESH_ERROR';
ALTER TABLE omnivore.subscriptions
ADD COLUMN refreshed_at timestamptz;
UPDATE omnivore.subscriptions
SET refreshed_at = last_fetched_at
WHERE last_fetched_at IS NOT NULL;
ALTER TABLE omnivore.subscriptions
RENAME COLUMN last_fetched_at TO most_recent_item_date;
COMMIT;

View file

@ -0,0 +1,13 @@
-- Type: UNDO
-- Name: alter_subscriptions
-- Description: Alter omnivore.subscriptions table to add a new state and date column
BEGIN;
ALTER TABLE omnivore.subscriptions
RENAME COLUMN most_recent_item_date TO last_fetched_at;
ALTER TABLE omnivore.subscriptions
DROP COLUMN refreshed_at;
COMMIT;