lemmy/migrations/2023-07-11-084714_receive_activity_table/down.sql
Dull Bananas 5d8af0d476 fix
2024-05-17 20:21:13 +00:00

31 lines
671 B
SQL

CREATE TABLE activity (
id serial PRIMARY KEY,
data jsonb NOT NULL,
local boolean NOT NULL DEFAULT TRUE,
published timestamp NOT NULL DEFAULT now(),
updated timestamp,
ap_id text NOT NULL,
sensitive boolean NOT NULL DEFAULT TRUE
);
INSERT INTO activity (ap_id, data, sensitive, published)
SELECT
ap_id,
data,
sensitive,
published
FROM
sent_activity
ORDER BY
id DESC
LIMIT 100000;
-- We cant copy received_activity entries back into activities table because we dont have data
-- which is mandatory.
DROP TABLE sent_activity;
DROP TABLE received_activity;
CREATE UNIQUE INDEX idx_activity_ap_id ON activity (ap_id);