Skip to content

Commit

Permalink
revert state history changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
PawelPawelec-RDX committed Jul 27, 2023
1 parent 1380cf7 commit ca08698
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@ private async Task<ExtendLedgerReport> ProcessTransactions(ReadWriteDbContext db
Id = sequences.EntityStateHistorySequence++,
FromStateVersion = stateVersion,
EntityId = referencedEntities.Get((EntityAddress)substateId.EntityAddress).DatabaseId,
State = componentState.Value.DataStruct.StructData.Hex.ConvertFromHex(),
State = componentState.Value.DataStruct.StructData.ToJson(),
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ public async Task<int> CopyEntityStateHistory(ICollection<EntityStateHistory> en
await writer.WriteAsync(e.Id, NpgsqlDbType.Bigint, token);
await writer.WriteAsync(e.FromStateVersion, NpgsqlDbType.Bigint, token);
await writer.WriteAsync(e.EntityId, NpgsqlDbType.Bigint, token);
await writer.WriteAsync(e.State, NpgsqlDbType.Bytea, token);
await writer.WriteAsync(e.State, NpgsqlDbType.Jsonb, token);
}

await writer.CompleteAsync(token);
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ protected override void Up(MigrationBuilder migrationBuilder)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
from_state_version = table.Column<long>(type: "bigint", nullable: false),
entity_id = table.Column<long>(type: "bigint", nullable: false),
state = table.Column<byte[]>(type: "bytea", nullable: false)
state = table.Column<string>(type: "jsonb", nullable: false)
},
constraints: table =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -574,9 +574,9 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.HasColumnType("bigint")
.HasColumnName("from_state_version");
b.Property<byte[]>("State")
b.Property<string>("State")
.IsRequired()
.HasColumnType("bytea")
.HasColumnType("jsonb")
.HasColumnName("state");
b.HasKey("Id");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,6 @@ internal class EntityStateHistory
[Column("entity_id")]
public long EntityId { get; set; }

[Column("state")]
public byte[] State { get; set; }
[Column("state", TypeName = "jsonb")]
public string State { get; set; }
}

0 comments on commit ca08698

Please sign in to comment.