-
Notifications
You must be signed in to change notification settings - Fork 0
fix(db): change state_data column from jsonb to text to fix 22P02 error #9
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,7 +43,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) | |
| entity.HasKey(e => e.Id); | ||
| entity.Property(e => e.AgentName).HasMaxLength(128).IsRequired(); | ||
| entity.Property(e => e.CurrentActivity).HasMaxLength(128).IsRequired(); | ||
| entity.Property(e => e.StateData).HasColumnType("jsonb"); | ||
| entity.Property(e => e.StateData).HasColumnType("text"); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While changing the column type to Since the |
||
| entity.Property(e => e.ErrorMessage).HasMaxLength(4096); | ||
| entity.HasIndex(e => new { e.AgentName, e.DocumentId }); | ||
| entity.HasIndex(e => e.IsCompleted); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing the column type in
init.sqlwill not update existing databases where the table already exists due to theIF NOT EXISTSclause. Additionally, a simple type cast fromJSONBtoTEXTin anALTER TABLEstatement will preserve JSON quotes (e.g., storing "SGVsbG8=" instead of SGVsbG8=). This will causeConvert.FromBase64Stringto fail inDocumentProcessingAgent.cs(line 82) when the agent attempts to resume from a checkpoint created before this change.Recommendation: Ensure a migration script is provided that both alters the type and unquotes existing data: