Add Conversation + Turn entities and migration

This commit is contained in:
2026-06-11 21:09:52 +00:00
parent 58b8a446b1
commit 99cfe60a2c
6 changed files with 686 additions and 0 deletions
@@ -208,6 +208,69 @@ namespace backend.Migrations
b.ToTable("AspNetUsers", (string)null);
});
modelBuilder.Entity("backend.Conversations.Conversation", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<Guid>("DeviceId")
.HasColumnType("TEXT");
b.Property<int>("EndReason")
.HasColumnType("INTEGER");
b.Property<DateTimeOffset?>("EndedAt")
.HasColumnType("TEXT");
b.Property<DateTimeOffset>("StartedAt")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("DeviceId");
b.ToTable("Conversations");
});
modelBuilder.Entity("backend.Conversations.Turn", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<Guid>("ConversationId")
.HasColumnType("TEXT");
b.Property<DateTimeOffset>("CreatedAt")
.HasColumnType("TEXT");
b.Property<int>("Index")
.HasColumnType("INTEGER");
b.Property<int>("Role")
.HasColumnType("INTEGER");
b.Property<string>("Text")
.HasColumnType("TEXT");
b.Property<string>("ToolArgsJson")
.HasColumnType("TEXT");
b.Property<string>("ToolName")
.HasColumnType("TEXT");
b.Property<string>("ToolResultJson")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("ConversationId", "Index")
.IsUnique();
b.ToTable("Turns");
});
modelBuilder.Entity("backend.Devices.Device", b =>
{
b.Property<Guid>("Id")
@@ -374,6 +437,15 @@ namespace backend.Migrations
.IsRequired();
});
modelBuilder.Entity("backend.Conversations.Turn", b =>
{
b.HasOne("backend.Conversations.Conversation", null)
.WithMany("Turns")
.HasForeignKey("ConversationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("backend.Devices.Device", b =>
{
b.HasOne("backend.Auth.ApplicationUser", null)
@@ -392,6 +464,11 @@ namespace backend.Migrations
.IsRequired();
});
modelBuilder.Entity("backend.Conversations.Conversation", b =>
{
b.Navigation("Turns");
});
modelBuilder.Entity("backend.Devices.Device", b =>
{
b.Navigation("Config");