Skip to content

Commit 0732577

Browse files
phernandezclaude
andcommitted
fix: Add explicit constraint name in mtime/size migration
SQLite batch operations require explicit constraint names. Changed from `None` to `batch_op.f("fk_entity_project_id")` to fix migration error: "Constraint must have a name" Fixes cloud deployment migration failure. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 3d82216 commit 0732577

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/basic_memory/alembic/versions/9d9c1cb7d8f5_add_mtime_and_size_columns_to_entity_.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,19 @@ def upgrade() -> None:
2525
batch_op.add_column(sa.Column("mtime", sa.Float(), nullable=True))
2626
batch_op.add_column(sa.Column("size", sa.Integer(), nullable=True))
2727
batch_op.drop_constraint(batch_op.f("fk_entity_project_id"), type_="foreignkey")
28-
batch_op.create_foreign_key(None, "project", ["project_id"], ["id"])
28+
batch_op.create_foreign_key(
29+
batch_op.f("fk_entity_project_id"), "project", ["project_id"], ["id"]
30+
)
2931

3032
# ### end Alembic commands ###
3133

3234

3335
def downgrade() -> None:
3436
# ### commands auto generated by Alembic - please adjust! ###
3537
with op.batch_alter_table("entity", schema=None) as batch_op:
36-
batch_op.drop_constraint(None, type_="foreignkey") # pyright: ignore [reportArgumentType]
38+
batch_op.drop_constraint(
39+
batch_op.f("fk_entity_project_id"), type_="foreignkey"
40+
)
3741
batch_op.create_foreign_key(
3842
batch_op.f("fk_entity_project_id"),
3943
"project",

0 commit comments

Comments
 (0)