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" diff --git a/libs/checkpoint-postgres/tests/test_async_store.py b/libs/checkpoint-postgres/tests/test_async_store.py index 09502403d..2c4ef16f7 100644 --- a/libs/checkpoint-postgres/tests/test_async_store.py +++ b/libs/checkpoint-postgres/tests/test_async_store.py @@ -60,9 +60,7 @@ async def store(request) -> AsyncIterator[AsyncPostgresStore]: ) as store: store.MIGRATIONS = [ ( - mig.replace( - "ADD COLUMN ttl_minutes INT;", "ADD COLUMN ttl_minutes FLOAT;" - ) + mig.replace("ttl_minutes INT;", "ttl_minutes FLOAT;") if isinstance(mig, str) else mig ) diff --git a/libs/checkpoint-postgres/tests/test_store.py b/libs/checkpoint-postgres/tests/test_store.py index 4ee37484e..b7aaf8a97 100644 --- a/libs/checkpoint-postgres/tests/test_store.py +++ b/libs/checkpoint-postgres/tests/test_store.py @@ -52,9 +52,7 @@ def store(request) -> PostgresStore: with PostgresStore.from_conn_string(conn_string, ttl=ttl_config) as store: store.MIGRATIONS = [ ( - mig.replace( - "ADD COLUMN ttl_minutes INT;", "ADD COLUMN ttl_minutes FLOAT;" - ) + mig.replace("ttl_minutes INT;", "ttl_minutes FLOAT;") if isinstance(mig, str) else mig )