fix: alembic migration non-optional field (#2528)

This commit is contained in:
Andy Li
2025-05-29 12:38:10 -07:00
committed by GitHub
parent 87f4bcad9a
commit 306175554f
3 changed files with 3 additions and 3 deletions

View File

@@ -21,7 +21,7 @@ depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.add_column("block", sa.Column("preserve_on_migration", sa.Boolean(), nullable=False))
op.add_column("block", sa.Column("preserve_on_migration", sa.Boolean(), nullable=True))
# ### end Alembic commands ###

View File

@@ -35,7 +35,7 @@ class Block(OrganizationMixin, SqlalchemyBase):
is_template: Mapped[bool] = mapped_column(
doc="whether the block is a template (e.g. saved human/persona options as baselines for other templates)", default=False
)
preserve_on_migration: Mapped[bool] = mapped_column(doc="preserve the block on template migration", default=False)
preserve_on_migration: Mapped[Optional[bool]] = mapped_column(doc="preserve the block on template migration", default=False)
value: Mapped[str] = mapped_column(doc="Text content of the block for the respective section of core memory.")
limit: Mapped[BigInteger] = mapped_column(Integer, default=CORE_MEMORY_BLOCK_CHAR_LIMIT, doc="Character limit of the block.")
metadata_: Mapped[Optional[dict]] = mapped_column(JSON, default={}, doc="arbitrary information related to the block.")

View File

@@ -21,7 +21,7 @@ class BaseBlock(LettaBase, validate_assignment=True):
# template data (optional)
template_name: Optional[str] = Field(None, description="Name of the block if it is a template.", alias="name")
is_template: bool = Field(False, description="Whether the block is a template (e.g. saved human/persona options).")
preserve_on_migration: bool = Field(False, description="Preserve the block on template migration.")
preserve_on_migration: Optional[bool] = Field(False, description="Preserve the block on template migration.")
# context window label
label: Optional[str] = Field(None, description="Label of the block (e.g. 'human', 'persona') in the context window.")