feat: add points rule migration
This commit is contained in:
parent
8cc1638d76
commit
3b8b86a258
598
src/Fengling.Member.Infrastructure/Migrations/20260209110951_AddPointsRuleSystem.Designer.cs
generated
Normal file
598
src/Fengling.Member.Infrastructure/Migrations/20260209110951_AddPointsRuleSystem.Designer.cs
generated
Normal file
@ -0,0 +1,598 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Fengling.Member.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Fengling.Member.Infrastructure.Migrations
|
||||
{
|
||||
[DbContext(typeof(ApplicationDbContext))]
|
||||
[Migration("20260209110951_AddPointsRuleSystem")]
|
||||
partial class AddPointsRuleSystem
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "9.0.0")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Fengling.Member.Domain.Aggregates.PointsModel.PointsAccount", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("created_at");
|
||||
|
||||
b.Property<int>("FrozenPoints")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasDefaultValue(0)
|
||||
.HasColumnName("frozen_points");
|
||||
|
||||
b.Property<long>("MemberId")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("user_id");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("tenant_id");
|
||||
|
||||
b.Property<int>("TotalPoints")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasDefaultValue(0)
|
||||
.HasColumnName("points");
|
||||
|
||||
b.Property<DateTime?>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("updated_at");
|
||||
|
||||
b.Property<int>("Version")
|
||||
.IsConcurrencyToken()
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasDefaultValue(1)
|
||||
.HasColumnName("version");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("MemberId")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("idx_points_account_memberid");
|
||||
|
||||
b.HasIndex("MemberId", "TenantId")
|
||||
.HasDatabaseName("idx_points_account_member_tenant");
|
||||
|
||||
b.ToTable("mka_integraldetails", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Fengling.Member.Domain.Aggregates.PointsModel.PointsTransaction", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTime>("ExpireAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<long>("MemberId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<int>("Points")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<long>("PointsAccountId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Remark")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("SourceId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("TransactionType")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("TransactionTypeCategory")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("PointsAccountId");
|
||||
|
||||
b.ToTable("PointsTransactions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Fengling.Member.Domain.Aggregates.PointsRuleModel.PointsRule", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uuid")
|
||||
.HasComment("规则标识");
|
||||
|
||||
b.Property<int>("BasePoints")
|
||||
.HasColumnType("integer")
|
||||
.HasComment("基础积分");
|
||||
|
||||
b.Property<int>("CalculationMode")
|
||||
.HasColumnType("integer")
|
||||
.HasComment("计算模式");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)")
|
||||
.HasComment("规则编码");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasComment("创建时间");
|
||||
|
||||
b.Property<DateTime>("EffectiveFrom")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasComment("生效开始时间");
|
||||
|
||||
b.Property<DateTime?>("EffectiveTo")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasComment("生效结束时间");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("boolean")
|
||||
.HasComment("是否启用");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("character varying(200)")
|
||||
.HasComment("规则名称");
|
||||
|
||||
b.Property<int>("Priority")
|
||||
.HasColumnType("integer")
|
||||
.HasComment("优先级");
|
||||
|
||||
b.Property<int>("RuleType")
|
||||
.HasColumnType("integer")
|
||||
.HasComment("规则类型");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasComment("更新时间");
|
||||
|
||||
b.Property<int>("ValidityDays")
|
||||
.HasColumnType("integer")
|
||||
.HasComment("有效期天数");
|
||||
|
||||
b.Property<decimal?>("WeightFactor")
|
||||
.HasPrecision(18, 4)
|
||||
.HasColumnType("numeric(18,4)")
|
||||
.HasComment("权重因子");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Code")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("IsActive");
|
||||
|
||||
b.ToTable("PointsRules", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Fengling.Member.Domain.Aggregates.PointsRuleModel.PointsRuleCondition", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uuid")
|
||||
.HasComment("条件标识");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasComment("创建时间");
|
||||
|
||||
b.Property<int>("DimensionType")
|
||||
.HasColumnType("integer")
|
||||
.HasComment("维度类型");
|
||||
|
||||
b.Property<string>("DimensionValue")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("character varying(200)")
|
||||
.HasComment("维度值");
|
||||
|
||||
b.Property<string>("Operator")
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)")
|
||||
.HasComment("操作符");
|
||||
|
||||
b.Property<Guid>("RuleId")
|
||||
.HasColumnType("uuid")
|
||||
.HasComment("关联规则标识");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RuleId", "DimensionType");
|
||||
|
||||
b.ToTable("PointsRuleConditions", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Fengling.Member.Domain.Aggregates.Users.MemberEntity", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("created_at");
|
||||
|
||||
b.Property<string>("OpenId")
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("character varying(64)")
|
||||
.HasColumnName("open_id");
|
||||
|
||||
b.Property<string>("PhoneNumber")
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)")
|
||||
.HasColumnName("phone_number");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)")
|
||||
.HasColumnName("status");
|
||||
|
||||
b.Property<long>("TenantId")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("tenant_id");
|
||||
|
||||
b.Property<string>("UnionId")
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("character varying(64)")
|
||||
.HasColumnName("union_id");
|
||||
|
||||
b.Property<DateTime?>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("updated_at");
|
||||
|
||||
b.Property<int>("Version")
|
||||
.IsConcurrencyToken()
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasDefaultValue(1)
|
||||
.HasColumnName("version");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OpenId")
|
||||
.HasDatabaseName("idx_member_openid");
|
||||
|
||||
b.HasIndex("TenantId")
|
||||
.HasDatabaseName("idx_member_tenantid");
|
||||
|
||||
b.HasIndex("UnionId")
|
||||
.HasDatabaseName("idx_member_unionid");
|
||||
|
||||
b.HasIndex("TenantId", "PhoneNumber")
|
||||
.HasDatabaseName("idx_member_tenant_phone");
|
||||
|
||||
b.ToTable("fls_member", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Fengling.Member.Domain.Aggregates.Users.MemberTag", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("created_at");
|
||||
|
||||
b.Property<long>("MemberId")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("member_id");
|
||||
|
||||
b.Property<string>("TagId")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)")
|
||||
.HasColumnName("tag_id");
|
||||
|
||||
b.Property<string>("TagName")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)")
|
||||
.HasColumnName("tag_name");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TagId")
|
||||
.HasDatabaseName("idx_membertag_tagid");
|
||||
|
||||
b.HasIndex("MemberId", "TagId")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("idx_membertag_member_tag");
|
||||
|
||||
b.ToTable("fls_member_tag", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Fengling.Member.Domain.Aggregates.Users.OAuthAuthorization", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("AccessToken")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("AuthorizedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTime?>("LastLoginAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<long>("MemberId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("OpenId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Provider")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("RefreshToken")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime?>("TokenExpiredAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("UnionId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("MemberId");
|
||||
|
||||
b.ToTable("OAuthAuthorization");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Fengling.Member.Domain.Aggregates.Users.WechatAuthorization", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<DateTime>("AuthorizedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("authorized_at");
|
||||
|
||||
b.Property<DateTime?>("LastLoginAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("last_login_at");
|
||||
|
||||
b.Property<long>("MemberId")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("member_id");
|
||||
|
||||
b.Property<string>("OpenId")
|
||||
.IsRequired()
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("character varying(64)")
|
||||
.HasColumnName("open_id");
|
||||
|
||||
b.Property<string>("UnionId")
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("character varying(64)")
|
||||
.HasColumnName("union_id");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("MemberId")
|
||||
.HasDatabaseName("idx_wechat_auth_memberid");
|
||||
|
||||
b.HasIndex("OpenId")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("idx_wechat_auth_openid");
|
||||
|
||||
b.HasIndex("UnionId")
|
||||
.HasDatabaseName("idx_wechat_auth_unionid");
|
||||
|
||||
b.ToTable("fls_wechat_authorization", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("NetCorePal.Extensions.DistributedTransactions.CAP.Persistence.CapLock", b =>
|
||||
{
|
||||
b.Property<string>("Key")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)");
|
||||
|
||||
b.Property<string>("Instance")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.Property<DateTime?>("LastLockTime")
|
||||
.HasColumnType("TIMESTAMP");
|
||||
|
||||
b.HasKey("Key");
|
||||
|
||||
b.ToTable("CAPLock", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("NetCorePal.Extensions.DistributedTransactions.CAP.Persistence.PublishedMessage", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<DateTime>("Added")
|
||||
.HasColumnType("TIMESTAMP");
|
||||
|
||||
b.Property<string>("Content")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime?>("ExpiresAt")
|
||||
.HasColumnType("TIMESTAMP");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("character varying(200)");
|
||||
|
||||
b.Property<int?>("Retries")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("StatusName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("character varying(40)");
|
||||
|
||||
b.Property<string>("Version")
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex(new[] { "ExpiresAt", "StatusName" }, "IX_ExpiresAt_StatusName");
|
||||
|
||||
b.HasIndex(new[] { "Version", "ExpiresAt", "StatusName" }, "IX_Version_ExpiresAt_StatusName");
|
||||
|
||||
b.ToTable("CAPPublishedMessage", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("NetCorePal.Extensions.DistributedTransactions.CAP.Persistence.ReceivedMessage", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<DateTime>("Added")
|
||||
.HasColumnType("TIMESTAMP");
|
||||
|
||||
b.Property<string>("Content")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime?>("ExpiresAt")
|
||||
.HasColumnType("TIMESTAMP");
|
||||
|
||||
b.Property<string>("Group")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("character varying(200)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(400)
|
||||
.HasColumnType("character varying(400)");
|
||||
|
||||
b.Property<int?>("Retries")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("StatusName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)");
|
||||
|
||||
b.Property<string>("Version")
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex(new[] { "ExpiresAt", "StatusName" }, "IX_ExpiresAt_StatusName")
|
||||
.HasDatabaseName("IX_ExpiresAt_StatusName1");
|
||||
|
||||
b.HasIndex(new[] { "Version", "ExpiresAt", "StatusName" }, "IX_Version_ExpiresAt_StatusName")
|
||||
.HasDatabaseName("IX_Version_ExpiresAt_StatusName1");
|
||||
|
||||
b.ToTable("CAPReceivedMessage", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Fengling.Member.Domain.Aggregates.PointsModel.PointsTransaction", b =>
|
||||
{
|
||||
b.HasOne("Fengling.Member.Domain.Aggregates.PointsModel.PointsAccount", null)
|
||||
.WithMany("Transactions")
|
||||
.HasForeignKey("PointsAccountId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Fengling.Member.Domain.Aggregates.PointsRuleModel.PointsRuleCondition", b =>
|
||||
{
|
||||
b.HasOne("Fengling.Member.Domain.Aggregates.PointsRuleModel.PointsRule", null)
|
||||
.WithMany("Conditions")
|
||||
.HasForeignKey("RuleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Fengling.Member.Domain.Aggregates.Users.MemberTag", b =>
|
||||
{
|
||||
b.HasOne("Fengling.Member.Domain.Aggregates.Users.MemberEntity", null)
|
||||
.WithMany("Tags")
|
||||
.HasForeignKey("MemberId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Fengling.Member.Domain.Aggregates.Users.OAuthAuthorization", b =>
|
||||
{
|
||||
b.HasOne("Fengling.Member.Domain.Aggregates.Users.MemberEntity", null)
|
||||
.WithMany("OAuthAuthorizations")
|
||||
.HasForeignKey("MemberId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Fengling.Member.Domain.Aggregates.PointsModel.PointsAccount", b =>
|
||||
{
|
||||
b.Navigation("Transactions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Fengling.Member.Domain.Aggregates.PointsRuleModel.PointsRule", b =>
|
||||
{
|
||||
b.Navigation("Conditions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Fengling.Member.Domain.Aggregates.Users.MemberEntity", b =>
|
||||
{
|
||||
b.Navigation("OAuthAuthorizations");
|
||||
|
||||
b.Navigation("Tags");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,206 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Fengling.Member.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddPointsRuleSystem : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_fls_wechat_authorization_fls_member_member_id",
|
||||
table: "fls_wechat_authorization");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_PointsTransaction_mka_integraldetails_PointsAccountId",
|
||||
table: "PointsTransaction");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_PointsTransaction",
|
||||
table: "PointsTransaction");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "PointsTransaction",
|
||||
newName: "PointsTransactions");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_PointsTransaction_PointsAccountId",
|
||||
table: "PointsTransactions",
|
||||
newName: "IX_PointsTransactions_PointsAccountId");
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "ExpireAt",
|
||||
table: "PointsTransactions",
|
||||
type: "timestamp with time zone",
|
||||
nullable: false,
|
||||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_PointsTransactions",
|
||||
table: "PointsTransactions",
|
||||
column: "Id");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "OAuthAuthorization",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
MemberId = table.Column<long>(type: "bigint", nullable: false),
|
||||
Provider = table.Column<int>(type: "integer", nullable: false),
|
||||
OpenId = table.Column<string>(type: "text", nullable: false),
|
||||
UnionId = table.Column<string>(type: "text", nullable: true),
|
||||
AccessToken = table.Column<string>(type: "text", nullable: true),
|
||||
RefreshToken = table.Column<string>(type: "text", nullable: true),
|
||||
TokenExpiredAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
||||
AuthorizedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
LastLoginAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_OAuthAuthorization", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_OAuthAuthorization_fls_member_MemberId",
|
||||
column: x => x.MemberId,
|
||||
principalTable: "fls_member",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "PointsRules",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false, comment: "规则标识"),
|
||||
Name = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false, comment: "规则名称"),
|
||||
Code = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false, comment: "规则编码"),
|
||||
RuleType = table.Column<int>(type: "integer", nullable: false, comment: "规则类型"),
|
||||
BasePoints = table.Column<int>(type: "integer", nullable: false, comment: "基础积分"),
|
||||
WeightFactor = table.Column<decimal>(type: "numeric(18,4)", precision: 18, scale: 4, nullable: true, comment: "权重因子"),
|
||||
ValidityDays = table.Column<int>(type: "integer", nullable: false, comment: "有效期天数"),
|
||||
Priority = table.Column<int>(type: "integer", nullable: false, comment: "优先级"),
|
||||
CalculationMode = table.Column<int>(type: "integer", nullable: false, comment: "计算模式"),
|
||||
IsActive = table.Column<bool>(type: "boolean", nullable: false, comment: "是否启用"),
|
||||
EffectiveFrom = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "生效开始时间"),
|
||||
EffectiveTo = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "生效结束时间"),
|
||||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间"),
|
||||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "更新时间")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PointsRules", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "PointsRuleConditions",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false, comment: "条件标识"),
|
||||
RuleId = table.Column<Guid>(type: "uuid", nullable: false, comment: "关联规则标识"),
|
||||
DimensionType = table.Column<int>(type: "integer", nullable: false, comment: "维度类型"),
|
||||
DimensionValue = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false, comment: "维度值"),
|
||||
Operator = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: true, comment: "操作符"),
|
||||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PointsRuleConditions", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_PointsRuleConditions_PointsRules_RuleId",
|
||||
column: x => x.RuleId,
|
||||
principalTable: "PointsRules",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_OAuthAuthorization_MemberId",
|
||||
table: "OAuthAuthorization",
|
||||
column: "MemberId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PointsRuleConditions_RuleId_DimensionType",
|
||||
table: "PointsRuleConditions",
|
||||
columns: new[] { "RuleId", "DimensionType" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PointsRules_Code",
|
||||
table: "PointsRules",
|
||||
column: "Code",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PointsRules_IsActive",
|
||||
table: "PointsRules",
|
||||
column: "IsActive");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_PointsTransactions_mka_integraldetails_PointsAccountId",
|
||||
table: "PointsTransactions",
|
||||
column: "PointsAccountId",
|
||||
principalTable: "mka_integraldetails",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_PointsTransactions_mka_integraldetails_PointsAccountId",
|
||||
table: "PointsTransactions");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "OAuthAuthorization");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "PointsRuleConditions");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "PointsRules");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_PointsTransactions",
|
||||
table: "PointsTransactions");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ExpireAt",
|
||||
table: "PointsTransactions");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "PointsTransactions",
|
||||
newName: "PointsTransaction");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_PointsTransactions_PointsAccountId",
|
||||
table: "PointsTransaction",
|
||||
newName: "IX_PointsTransaction_PointsAccountId");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_PointsTransaction",
|
||||
table: "PointsTransaction",
|
||||
column: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_fls_wechat_authorization_fls_member_member_id",
|
||||
table: "fls_wechat_authorization",
|
||||
column: "member_id",
|
||||
principalTable: "fls_member",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_PointsTransaction_mka_integraldetails_PointsAccountId",
|
||||
table: "PointsTransaction",
|
||||
column: "PointsAccountId",
|
||||
principalTable: "mka_integraldetails",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -89,6 +89,9 @@ namespace Fengling.Member.Infrastructure.Migrations
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTime>("ExpireAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<long>("MemberId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
@ -116,7 +119,116 @@ namespace Fengling.Member.Infrastructure.Migrations
|
||||
|
||||
b.HasIndex("PointsAccountId");
|
||||
|
||||
b.ToTable("PointsTransaction");
|
||||
b.ToTable("PointsTransactions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Fengling.Member.Domain.Aggregates.PointsRuleModel.PointsRule", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uuid")
|
||||
.HasComment("规则标识");
|
||||
|
||||
b.Property<int>("BasePoints")
|
||||
.HasColumnType("integer")
|
||||
.HasComment("基础积分");
|
||||
|
||||
b.Property<int>("CalculationMode")
|
||||
.HasColumnType("integer")
|
||||
.HasComment("计算模式");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)")
|
||||
.HasComment("规则编码");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasComment("创建时间");
|
||||
|
||||
b.Property<DateTime>("EffectiveFrom")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasComment("生效开始时间");
|
||||
|
||||
b.Property<DateTime?>("EffectiveTo")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasComment("生效结束时间");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("boolean")
|
||||
.HasComment("是否启用");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("character varying(200)")
|
||||
.HasComment("规则名称");
|
||||
|
||||
b.Property<int>("Priority")
|
||||
.HasColumnType("integer")
|
||||
.HasComment("优先级");
|
||||
|
||||
b.Property<int>("RuleType")
|
||||
.HasColumnType("integer")
|
||||
.HasComment("规则类型");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasComment("更新时间");
|
||||
|
||||
b.Property<int>("ValidityDays")
|
||||
.HasColumnType("integer")
|
||||
.HasComment("有效期天数");
|
||||
|
||||
b.Property<decimal?>("WeightFactor")
|
||||
.HasPrecision(18, 4)
|
||||
.HasColumnType("numeric(18,4)")
|
||||
.HasComment("权重因子");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Code")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("IsActive");
|
||||
|
||||
b.ToTable("PointsRules", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Fengling.Member.Domain.Aggregates.PointsRuleModel.PointsRuleCondition", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uuid")
|
||||
.HasComment("条件标识");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasComment("创建时间");
|
||||
|
||||
b.Property<int>("DimensionType")
|
||||
.HasColumnType("integer")
|
||||
.HasComment("维度类型");
|
||||
|
||||
b.Property<string>("DimensionValue")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("character varying(200)")
|
||||
.HasComment("维度值");
|
||||
|
||||
b.Property<string>("Operator")
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)")
|
||||
.HasComment("操作符");
|
||||
|
||||
b.Property<Guid>("RuleId")
|
||||
.HasColumnType("uuid")
|
||||
.HasComment("关联规则标识");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RuleId", "DimensionType");
|
||||
|
||||
b.ToTable("PointsRuleConditions", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Fengling.Member.Domain.Aggregates.Users.MemberEntity", b =>
|
||||
@ -225,6 +337,49 @@ namespace Fengling.Member.Infrastructure.Migrations
|
||||
b.ToTable("fls_member_tag", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Fengling.Member.Domain.Aggregates.Users.OAuthAuthorization", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("AccessToken")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("AuthorizedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTime?>("LastLoginAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<long>("MemberId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("OpenId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Provider")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("RefreshToken")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime?>("TokenExpiredAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("UnionId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("MemberId");
|
||||
|
||||
b.ToTable("OAuthAuthorization");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Fengling.Member.Domain.Aggregates.Users.WechatAuthorization", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
@ -391,6 +546,15 @@ namespace Fengling.Member.Infrastructure.Migrations
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Fengling.Member.Domain.Aggregates.PointsRuleModel.PointsRuleCondition", b =>
|
||||
{
|
||||
b.HasOne("Fengling.Member.Domain.Aggregates.PointsRuleModel.PointsRule", null)
|
||||
.WithMany("Conditions")
|
||||
.HasForeignKey("RuleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Fengling.Member.Domain.Aggregates.Users.MemberTag", b =>
|
||||
{
|
||||
b.HasOne("Fengling.Member.Domain.Aggregates.Users.MemberEntity", null)
|
||||
@ -400,10 +564,10 @@ namespace Fengling.Member.Infrastructure.Migrations
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Fengling.Member.Domain.Aggregates.Users.WechatAuthorization", b =>
|
||||
modelBuilder.Entity("Fengling.Member.Domain.Aggregates.Users.OAuthAuthorization", b =>
|
||||
{
|
||||
b.HasOne("Fengling.Member.Domain.Aggregates.Users.MemberEntity", null)
|
||||
.WithMany("WechatAuthorizations")
|
||||
.WithMany("OAuthAuthorizations")
|
||||
.HasForeignKey("MemberId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
@ -414,11 +578,16 @@ namespace Fengling.Member.Infrastructure.Migrations
|
||||
b.Navigation("Transactions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Fengling.Member.Domain.Aggregates.PointsRuleModel.PointsRule", b =>
|
||||
{
|
||||
b.Navigation("Conditions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Fengling.Member.Domain.Aggregates.Users.MemberEntity", b =>
|
||||
{
|
||||
b.Navigation("Tags");
|
||||
b.Navigation("OAuthAuthorizations");
|
||||
|
||||
b.Navigation("WechatAuthorizations");
|
||||
b.Navigation("Tags");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user