From e5b5f9510b84777aeb45f3f18327e58720ccc07b Mon Sep 17 00:00:00 2001 From: William FH <13333726+hinthornw@users.noreply.github.com> Date: Thu, 9 Jan 2025 15:14:02 -0800 Subject: [PATCH] Fix empty migration (#2978) --- .../langgraph/checkpoint/postgres/base.py | 2 -- libs/checkpoint-postgres/pyproject.toml | 2 +- libs/checkpoint-postgres/tests/test_store.py | 8 ++++++++ libs/checkpoint-postgres/tests/test_sync.py | 8 ++++++++ 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/libs/checkpoint-postgres/langgraph/checkpoint/postgres/base.py b/libs/checkpoint-postgres/langgraph/checkpoint/postgres/base.py index b18ab8f4d..7ec55203a 100644 --- a/libs/checkpoint-postgres/langgraph/checkpoint/postgres/base.py +++ b/libs/checkpoint-postgres/langgraph/checkpoint/postgres/base.py @@ -58,8 +58,6 @@ );""", "ALTER TABLE checkpoint_blobs ALTER COLUMN blob DROP not null;", """ - """, - """ CREATE INDEX CONCURRENTLY IF NOT EXISTS checkpoints_thread_id_idx ON checkpoints(thread_id); """, """ diff --git a/libs/checkpoint-postgres/pyproject.toml b/libs/checkpoint-postgres/pyproject.toml index d251aa281..9ef4628d8 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.9" +version = "2.0.10" description = "Library with a Postgres implementation of LangGraph checkpoint saver." authors = [] license = "MIT" diff --git a/libs/checkpoint-postgres/tests/test_store.py b/libs/checkpoint-postgres/tests/test_store.py index 35dfa2150..50d697962 100644 --- a/libs/checkpoint-postgres/tests/test_store.py +++ b/libs/checkpoint-postgres/tests/test_store.py @@ -1,5 +1,6 @@ # type: ignore +import re from contextlib import contextmanager from typing import Any, Optional from uuid import uuid4 @@ -782,3 +783,10 @@ def test_scores( assert len(results) == 1 assert results[0].score == pytest.approx(similarities[0], abs=1e-3) + + +def test_nonnull_migrations() -> None: + _leading_comment_remover = re.compile(r"^/\*.*?\*/") + for migration in PostgresStore.MIGRATIONS: + statement = _leading_comment_remover.sub("", migration).split()[0] + assert statement.strip() diff --git a/libs/checkpoint-postgres/tests/test_sync.py b/libs/checkpoint-postgres/tests/test_sync.py index c5cdbd431..3cc00ee28 100644 --- a/libs/checkpoint-postgres/tests/test_sync.py +++ b/libs/checkpoint-postgres/tests/test_sync.py @@ -1,5 +1,6 @@ # type: ignore +import re from contextlib import contextmanager from typing import Any from uuid import uuid4 @@ -238,3 +239,10 @@ def test_null_chars(saver_name: str, test_data) -> None: list(saver.list(None, filter={"my_key": "abc"}))[0].metadata["my_key"] == "abc" ) + + +def test_nonnull_migrations() -> None: + _leading_comment_remover = re.compile(r"^/\*.*?\*/") + for migration in PostgresSaver.MIGRATIONS: + statement = _leading_comment_remover.sub("", migration).split()[0] + assert statement.strip()