From 697f878e3619a145e8ad5e4ee9342ac9b1bb3311 Mon Sep 17 00:00:00 2001 From: William Fu-Hinthorn <13333726+hinthornw@users.noreply.github.com> Date: Mon, 17 Mar 2025 12:38:43 -0700 Subject: [PATCH] Make expires_at idempotent --- libs/checkpoint-postgres/langgraph/store/postgres/base.py | 6 +++--- libs/checkpoint-postgres/pyproject.toml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/checkpoint-postgres/langgraph/store/postgres/base.py b/libs/checkpoint-postgres/langgraph/store/postgres/base.py index d6035bb70..338f5e890 100644 --- a/libs/checkpoint-postgres/langgraph/store/postgres/base.py +++ b/libs/checkpoint-postgres/langgraph/store/postgres/base.py @@ -79,12 +79,12 @@ CREATE INDEX CONCURRENTLY IF NOT EXISTS store_prefix_idx ON store USING btree (p """ -- Add expires_at column to store table ALTER TABLE store -ADD COLUMN expires_at TIMESTAMP WITH TIME ZONE, -ADD COLUMN ttl_minutes INT; +ADD COLUMN IF NOT EXISTS expires_at TIMESTAMP WITH TIME ZONE, +ADD COLUMN IF NOT EXISTS ttl_minutes INT; """, """ -- Add indexes for efficient TTL sweeping -CREATE INDEX idx_store_expires_at ON store (expires_at) +CREATE INDEX IF NOT EXISTS idx_store_expires_at ON store (expires_at) WHERE expires_at IS NOT NULL; """, ] diff --git a/libs/checkpoint-postgres/pyproject.toml b/libs/checkpoint-postgres/pyproject.toml index 0d9ac1c12..7c727163a 100644 --- a/libs/checkpoint-postgres/pyproject.toml +++ b/libs/checkpoint-postgres/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "langgraph-checkpoint-postgres" -version = "2.0.17" +version = "2.0.18" description = "Library with a Postgres implementation of LangGraph checkpoint saver." authors = [] license = "MIT"