//
using System;
using MiaoJiZhang.Infrastructure.Persistence;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace MiaoJiZhang.Infrastructure.Persistence.Migrations
{
[DbContext(typeof(AppDbContext))]
partial class AppDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.8")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
modelBuilder.Entity("MiaoJiZhang.Domain.Entities.AiAvatar", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
b.Property("DefaultName")
.IsRequired()
.HasColumnType("longtext");
b.Property("ImageUrl")
.HasColumnType("longtext");
b.Property("IsEnabled")
.HasColumnType("tinyint(1)");
b.Property("Key")
.IsRequired()
.HasColumnType("varchar(255)");
b.Property("SpeechTic")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("Id");
b.HasIndex("Key")
.IsUnique();
b.ToTable("AiAvatars");
});
modelBuilder.Entity("MiaoJiZhang.Domain.Entities.AiCompanionSetting", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
b.Property("AvatarKey")
.IsRequired()
.HasColumnType("longtext");
b.Property("CustomName")
.HasColumnType("longtext");
b.Property("PersonaKey")
.IsRequired()
.HasColumnType("longtext");
b.Property("ProactiveLevel")
.HasColumnType("int");
b.Property("RoastLevel")
.HasColumnType("int");
b.Property("StickerFrequency")
.HasColumnType("int");
b.Property("UserId")
.HasColumnType("bigint");
b.HasKey("Id");
b.HasIndex("UserId")
.IsUnique();
b.ToTable("AiCompanionSettings");
});
modelBuilder.Entity("MiaoJiZhang.Domain.Entities.AiPersona", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
b.Property("Description")
.IsRequired()
.HasColumnType("longtext");
b.Property("IsEnabled")
.HasColumnType("tinyint(1)");
b.Property("Key")
.IsRequired()
.HasColumnType("varchar(255)");
b.Property("Name")
.IsRequired()
.HasColumnType("longtext");
b.Property("PromptTemplate")
.IsRequired()
.HasColumnType("longtext");
b.Property("SampleLine")
.IsRequired()
.HasColumnType("longtext");
b.Property("Version")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("Key")
.IsUnique();
b.ToTable("AiPersonas");
});
modelBuilder.Entity("MiaoJiZhang.Domain.Entities.AppConfig", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
b.Property("Key")
.IsRequired()
.HasColumnType("varchar(255)");
b.Property("UpdatedAt")
.HasColumnType("datetime(6)");
b.Property("Value")
.IsRequired()
.HasColumnType("longtext");
b.Property("Version")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("Key")
.IsUnique();
b.ToTable("AppConfigs");
});
modelBuilder.Entity("MiaoJiZhang.Domain.Entities.Budget", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
b.Property("Amount")
.HasPrecision(12, 2)
.HasColumnType("decimal(12,2)");
b.Property("CategoryId")
.HasColumnType("bigint");
b.Property("LedgerId")
.HasColumnType("bigint");
b.Property("Period")
.HasColumnType("int");
b.Property("UserId")
.HasColumnType("bigint");
b.HasKey("Id");
b.HasIndex("LedgerId", "Period", "CategoryId")
.IsUnique();
b.ToTable("Budgets");
});
modelBuilder.Entity("MiaoJiZhang.Domain.Entities.Category", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
b.Property("ColorKey")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("varchar(32)");
b.Property("IconKey")
.IsRequired()
.HasColumnType("longtext");
b.Property("IsDeleted")
.HasColumnType("tinyint(1)");
b.Property("Name")
.IsRequired()
.HasColumnType("longtext");
b.Property("SortOrder")
.HasColumnType("int");
b.Property("Type")
.HasColumnType("int");
b.Property("UserId")
.HasColumnType("bigint");
b.HasKey("Id");
b.ToTable("Categories");
});
modelBuilder.Entity("MiaoJiZhang.Domain.Entities.ChatMessage", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
b.Property("Content")
.IsRequired()
.HasColumnType("longtext");
b.Property("CreatedAt")
.HasColumnType("datetime(6)");
b.Property("Role")
.HasColumnType("int");
b.Property("TransactionId")
.HasColumnType("bigint");
b.Property("Type")
.HasColumnType("int");
b.Property("UserId")
.HasColumnType("bigint");
b.HasKey("Id");
b.HasIndex("UserId", "CreatedAt");
b.ToTable("ChatMessages");
});
modelBuilder.Entity("MiaoJiZhang.Domain.Entities.Ledger", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
b.Property("CreatedAt")
.HasColumnType("datetime(6)");
b.Property("IconKey")
.IsRequired()
.HasColumnType("longtext");
b.Property("IsDefault")
.HasColumnType("tinyint(1)");
b.Property("Name")
.IsRequired()
.HasColumnType("longtext");
b.Property("OwnerId")
.HasColumnType("bigint");
b.HasKey("Id");
b.HasIndex("OwnerId");
b.ToTable("Ledgers");
});
modelBuilder.Entity("MiaoJiZhang.Domain.Entities.Sticker", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
b.Property("GroupKey")
.IsRequired()
.HasColumnType("longtext");
b.Property("ImageUrl")
.HasColumnType("longtext");
b.Property("IsEnabled")
.HasColumnType("tinyint(1)");
b.Property("Key")
.IsRequired()
.HasColumnType("varchar(255)");
b.Property("Label")
.IsRequired()
.HasColumnType("longtext");
b.Property("TriggerTags")
.HasColumnType("longtext");
b.HasKey("Id");
b.HasIndex("Key")
.IsUnique();
b.ToTable("Stickers");
});
modelBuilder.Entity("MiaoJiZhang.Domain.Entities.Transaction", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
b.Property("Amount")
.HasPrecision(12, 2)
.HasColumnType("decimal(12,2)");
b.Property("CategoryId")
.HasColumnType("bigint");
b.Property("ClientRequestId")
.HasMaxLength(64)
.HasColumnType("varchar(64)");
b.Property("CreatedAt")
.HasColumnType("datetime(6)");
b.Property("DeletedAt")
.HasColumnType("datetime(6)");
b.Property("IsDeleted")
.HasColumnType("tinyint(1)");
b.Property("LedgerId")
.HasColumnType("bigint");
b.Property("Note")
.HasColumnType("longtext");
b.Property("OccurredAt")
.HasColumnType("datetime(6)");
b.Property("PaymentMethod")
.HasColumnType("longtext");
b.Property("Source")
.HasColumnType("int");
b.Property("SourceChatMessageId")
.HasColumnType("bigint");
b.Property("SourceText")
.HasColumnType("longtext");
b.Property("Type")
.HasColumnType("int");
b.Property("UpdatedAt")
.HasColumnType("datetime(6)");
b.Property("UserId")
.HasColumnType("bigint");
b.HasKey("Id");
b.HasIndex("CategoryId");
b.HasIndex("LedgerId", "OccurredAt");
b.HasIndex("UserId", "IsDeleted");
b.HasIndex("UserId", "ClientRequestId")
.IsUnique();
b.ToTable("Transactions");
});
modelBuilder.Entity("MiaoJiZhang.Domain.Entities.UserFeaturePermission", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
b.Property("CreatedAt")
.HasColumnType("datetime(6)");
b.Property("IsEnabled")
.HasColumnType("tinyint(1)");
b.Property("PermissionKey")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("varchar(32)");
b.Property("UpdatedAt")
.HasColumnType("datetime(6)");
b.Property("UserId")
.HasColumnType("bigint");
b.HasKey("Id");
b.HasIndex("UserId", "PermissionKey")
.IsUnique();
b.ToTable("UserFeaturePermissions");
});
modelBuilder.Entity("MiaoJiZhang.Domain.Entities.User", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
b.Property("AppMode")
.HasColumnType("int");
b.Property("AiChatLimit")
.HasColumnType("int");
b.Property("AiChatPeriod")
.HasColumnType("int");
b.Property("AiChatUsed")
.HasColumnType("int");
b.Property("AiChatWindowStartedAt")
.HasColumnType("datetime(6)");
b.Property("AccountClosureRequestedAt")
.HasColumnType("datetime(6)");
b.Property("AccountClosureScheduledAt")
.HasColumnType("datetime(6)");
b.Property("AppleUserId")
.HasColumnType("longtext");
b.Property("AvatarUrl")
.HasColumnType("longtext");
b.Property("CreatedAt")
.HasColumnType("datetime(6)");
b.Property("Email")
.HasColumnType("varchar(255)");
b.Property("EmailVerified")
.HasColumnType("tinyint(1)");
b.Property("AuthVersion")
.HasColumnType("int");
b.Property("IsBanned")
.HasColumnType("tinyint(1)");
b.Property("LastLoginAt")
.HasColumnType("datetime(6)");
b.Property("Nickname")
.HasMaxLength(32)
.HasColumnType("varchar(32)");
b.Property("PasswordHash")
.IsRequired()
.HasColumnType("longtext");
b.Property("Phone")
.HasColumnType("varchar(255)");
b.Property("PhoneVerified")
.HasColumnType("tinyint(1)");
b.Property("Username")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("varchar(32)");
b.Property("WeChatOpenId")
.HasColumnType("varchar(255)");
b.Property("WeChatUnionId")
.HasColumnType("longtext");
b.HasKey("Id");
b.HasIndex("AccountClosureScheduledAt");
b.HasIndex("Email")
.IsUnique();
b.HasIndex("Phone")
.IsUnique();
b.HasIndex("Username")
.IsUnique();
b.HasIndex("WeChatOpenId")
.IsUnique();
b.ToTable("Users");
});
modelBuilder.Entity("MiaoJiZhang.Domain.Entities.AiCompanionSetting", b =>
{
b.HasOne("MiaoJiZhang.Domain.Entities.User", "User")
.WithOne("AiCompanion")
.HasForeignKey("MiaoJiZhang.Domain.Entities.AiCompanionSetting", "UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("MiaoJiZhang.Domain.Entities.Budget", b =>
{
b.HasOne("MiaoJiZhang.Domain.Entities.Ledger", "Ledger")
.WithMany("Budgets")
.HasForeignKey("LedgerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Ledger");
});
modelBuilder.Entity("MiaoJiZhang.Domain.Entities.Ledger", b =>
{
b.HasOne("MiaoJiZhang.Domain.Entities.User", "Owner")
.WithMany("Ledgers")
.HasForeignKey("OwnerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Owner");
});
modelBuilder.Entity("MiaoJiZhang.Domain.Entities.Transaction", b =>
{
b.HasOne("MiaoJiZhang.Domain.Entities.Category", "Category")
.WithMany()
.HasForeignKey("CategoryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("MiaoJiZhang.Domain.Entities.Ledger", "Ledger")
.WithMany("Transactions")
.HasForeignKey("LedgerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Category");
b.Navigation("Ledger");
});
modelBuilder.Entity("MiaoJiZhang.Domain.Entities.UserFeaturePermission", b =>
{
b.HasOne("MiaoJiZhang.Domain.Entities.User", "User")
.WithMany("FeaturePermissions")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("MiaoJiZhang.Domain.Entities.Ledger", b =>
{
b.Navigation("Budgets");
b.Navigation("Transactions");
});
modelBuilder.Entity("MiaoJiZhang.Domain.Entities.User", b =>
{
b.Navigation("AiCompanion");
b.Navigation("FeaturePermissions");
b.Navigation("Ledgers");
});
#pragma warning restore 612, 618
}
}
}