forked from mtusi2026/mtusi2026lab5
ЛР 5: асинхронная обработка изображений, уровень 5
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
-- +goose Up
|
||||
ALTER TABLE attachments ADD COLUMN variants jsonb NOT NULL DEFAULT '[]';
|
||||
ALTER TABLE attachments ADD COLUMN lease_until timestamptz;
|
||||
ALTER TABLE attachments ADD COLUMN next_attempt_at timestamptz NOT NULL DEFAULT now();
|
||||
CREATE TABLE attachment_outbox (
|
||||
attachment_id uuid PRIMARY KEY REFERENCES attachments(id),
|
||||
next_publish_at timestamptz NOT NULL DEFAULT now()
|
||||
);
|
||||
CREATE TABLE attachment_replays (
|
||||
id bigserial PRIMARY KEY, attachment_id uuid NOT NULL REFERENCES attachments(id),
|
||||
replayed_at timestamptz NOT NULL DEFAULT now()
|
||||
);
|
||||
INSERT INTO attachment_outbox(attachment_id) SELECT id FROM attachments WHERE status IN ('queued','processing');
|
||||
-- +goose Down
|
||||
DROP TABLE attachment_replays;
|
||||
DROP TABLE attachment_outbox;
|
||||
ALTER TABLE attachments DROP COLUMN variants, DROP COLUMN lease_until, DROP COLUMN next_attempt_at;
|
||||
Reference in New Issue
Block a user