Skip to content

Commit ff38f75

Browse files
authored
fix(checkpoint-postgres): make async PG checkpoint migration idempotent (#6400)
- **Description:** The final migration for the postgres checkpointer is not currently idempotent. That presents problems when migrating from one checkpointer to another or if migrations otherwise get applied twice. This makes the final migration idempotent to avoid this problem. - **Issue:** N/A - **Dependencies:** N/A - **Twitter handle:** N/A
1 parent bbdd007 commit ff38f75

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

libs/checkpoint-postgres/langgraph/checkpoint/postgres/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
"""
8282
CREATE INDEX CONCURRENTLY IF NOT EXISTS checkpoint_writes_thread_id_idx ON checkpoint_writes(thread_id);
8383
""",
84-
"""ALTER TABLE checkpoint_writes ADD COLUMN task_path TEXT NOT NULL DEFAULT '';""",
84+
"""ALTER TABLE checkpoint_writes ADD COLUMN IF NOT EXISTS task_path TEXT NOT NULL DEFAULT '';""",
8585
]
8686

8787
SELECT_SQL = """

libs/checkpoint-postgres/langgraph/checkpoint/postgres/shallow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
CREATE INDEX CONCURRENTLY IF NOT EXISTS checkpoint_writes_thread_id_idx ON checkpoint_writes(thread_id);
7878
""",
7979
"""
80-
ALTER TABLE checkpoint_writes ADD COLUMN task_path TEXT NOT NULL DEFAULT '';
80+
ALTER TABLE checkpoint_writes ADD COLUMN IF NOT EXISTS task_path TEXT NOT NULL DEFAULT '';
8181
""",
8282
]
8383

0 commit comments

Comments
 (0)