Files
probably-rendering-one-more…/apps/dashboard/db/011_post_archiving.sql
T

7 lines
362 B
PL/PgSQL

BEGIN;
ALTER TABLE posts ADD COLUMN IF NOT EXISTS archived boolean NOT NULL DEFAULT false;
ALTER TABLE posts ADD COLUMN IF NOT EXISTS archived_at timestamptz;
CREATE INDEX IF NOT EXISTS posts_active_timeline ON posts(created_at DESC,id DESC) WHERE NOT archived;
INSERT INTO schema_migrations(version) VALUES('011_post_archiving') ON CONFLICT DO NOTHING;
COMMIT;