调整地区实体

This commit is contained in:
2025-12-24 12:15:53 +08:00
parent a1516490d2
commit e396e66959
17 changed files with 1349 additions and 75 deletions

View File

@@ -23,11 +23,11 @@ namespace Atomx.Data
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
builder.Entity<Currency>(entity =>
{
entity.Property(e => e.Id).ValueGeneratedOnAdd();
});
//base.OnModelCreating(builder);
//builder.Entity<Currency>(entity =>
//{
// entity.Property(e => e.Id).ValueGeneratedOnAdd();
//});
}
/// <summary>
@@ -46,7 +46,7 @@ namespace Atomx.Data
public DbSet<AppVersion> AppVersions { get; set; }
/// <summary>
/// 国家省市地区
/// 市区数据
/// </summary>
public DbSet<Area> Areas { get; set; }
@@ -60,6 +60,11 @@ namespace Atomx.Data
/// </summary>
public DbSet<Channel> Channels { get; set; }
/// <summary>
/// 国家数据
/// </summary>
public DbSet<Country> Countries { get; set; }
/// <summary>
/// 货币信息
/// </summary>
@@ -136,6 +141,11 @@ namespace Atomx.Data
/// </summary>
public DbSet<SpecificationAttributeOption> SpecificationAttributeOptions { get; set; }
/// <summary>
/// 州省份数据
/// </summary>
public DbSet<StateProvince> StateProvinces { get; set; }
/// <summary>
/// 刷新Tokens
/// </summary>

View File

@@ -12,7 +12,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Atomx.Data.Migrations
{
[DbContext(typeof(DataContext))]
[Migration("20251223083953_0.1")]
[Migration("20251224030208_0.1")]
partial class _01
{
/// <inheritdoc />
@@ -242,6 +242,9 @@ namespace Atomx.Data.Migrations
b.Property<bool>("AllowShipping")
.HasColumnType("boolean");
b.Property<long>("CountryId")
.HasColumnType("bigint");
b.Property<int>("DisplayOrder")
.HasColumnType("integer");
@@ -256,19 +259,11 @@ namespace Atomx.Data.Migrations
.IsRequired()
.HasColumnType("varchar(256)");
b.Property<int>("NumericISOCode")
.HasColumnType("integer");
b.Property<long>("ParentId")
.HasColumnType("bigint");
b.Property<string>("ThreeLetterISOCode")
.IsRequired()
.HasColumnType("varchar(3)");
b.Property<string>("TwoLetterISOCode")
.IsRequired()
.HasColumnType("varchar(2)");
b.Property<long>("StateProvinceId")
.HasColumnType("bigint");
b.HasKey("Id");
@@ -350,8 +345,11 @@ namespace Atomx.Data.Migrations
modelBuilder.Entity("Atomx.Common.Entities.Channel", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Config")
.IsRequired()
.HasColumnType("text");
@@ -394,6 +392,44 @@ namespace Atomx.Data.Migrations
b.ToTable("Channels");
});
modelBuilder.Entity("Atomx.Common.Entities.Country", b =>
{
b.Property<long>("Id")
.HasColumnType("bigint");
b.Property<bool>("AllowShipping")
.HasColumnType("boolean");
b.Property<int>("DisplayOrder")
.HasColumnType("integer");
b.Property<bool>("Enabled")
.HasColumnType("boolean");
b.Property<string>("Initial")
.IsRequired()
.HasColumnType("varchar(1)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("varchar(256)");
b.Property<int>("NumericISOCode")
.HasColumnType("integer");
b.Property<string>("ThreeLetterISOCode")
.IsRequired()
.HasColumnType("varchar(3)");
b.Property<string>("TwoLetterISOCode")
.IsRequired()
.HasColumnType("varchar(2)");
b.HasKey("Id");
b.ToTable("Countries");
});
modelBuilder.Entity("Atomx.Common.Entities.Currency", b =>
{
b.Property<int>("Id")
@@ -460,6 +496,9 @@ namespace Atomx.Data.Migrations
b.Property<long>("Id")
.HasColumnType("bigint");
b.Property<int>("ChannelId")
.HasColumnType("integer");
b.Property<DateTime>("CreateTime")
.HasColumnType("timestamptz");
@@ -473,9 +512,6 @@ namespace Atomx.Data.Migrations
.IsRequired()
.HasColumnType("text");
b.Property<int>("PayChannelId")
.HasColumnType("integer");
b.Property<decimal>("Rate")
.HasColumnType("numeric");
@@ -581,7 +617,7 @@ namespace Atomx.Data.Migrations
.IsRequired()
.HasColumnType("varchar(256)");
b.Property<int>("LanguageNumber")
b.Property<int>("LanguageId")
.HasColumnType("integer");
b.Property<int>("Type")
@@ -1339,6 +1375,37 @@ namespace Atomx.Data.Migrations
b.ToTable("SpecificationAttributeOptions");
});
modelBuilder.Entity("Atomx.Common.Entities.StateProvince", b =>
{
b.Property<long>("Id")
.HasColumnType("bigint");
b.Property<string>("Abbreviation")
.IsRequired()
.HasColumnType("varchar(32)");
b.Property<long>("CountryId")
.HasColumnType("bigint");
b.Property<int>("DisplayOrder")
.HasColumnType("integer");
b.Property<bool>("Enabled")
.HasColumnType("boolean");
b.Property<string>("Initial")
.IsRequired()
.HasColumnType("varchar(1)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("varchar(256)");
b.HasKey("Id");
b.ToTable("StateProvinces");
});
modelBuilder.Entity("Atomx.Common.Entities.Tag", b =>
{
b.Property<long>("Id")

View File

@@ -101,12 +101,11 @@ namespace Atomx.Data.Migrations
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false),
CountryId = table.Column<long>(type: "bigint", nullable: false),
StateProvinceId = table.Column<long>(type: "bigint", nullable: false),
ParentId = table.Column<long>(type: "bigint", nullable: false),
Name = table.Column<string>(type: "varchar(256)", nullable: false),
Initial = table.Column<string>(type: "varchar(1)", nullable: false),
TwoLetterISOCode = table.Column<string>(type: "varchar(2)", nullable: false),
ThreeLetterISOCode = table.Column<string>(type: "varchar(3)", nullable: false),
NumericISOCode = table.Column<int>(type: "integer", nullable: false),
AllowShipping = table.Column<bool>(type: "boolean", nullable: false),
Enabled = table.Column<bool>(type: "boolean", nullable: false),
DisplayOrder = table.Column<int>(type: "integer", nullable: false)
@@ -149,7 +148,8 @@ namespace Atomx.Data.Migrations
name: "Channels",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false),
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
SiteId = table.Column<int>(type: "integer", nullable: false),
Type = table.Column<int>(type: "integer", nullable: false),
Network = table.Column<int>(type: "integer", nullable: false),
@@ -167,6 +167,25 @@ namespace Atomx.Data.Migrations
table.PrimaryKey("PK_Channels", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Countries",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false),
Name = table.Column<string>(type: "varchar(256)", nullable: false),
Initial = table.Column<string>(type: "varchar(1)", nullable: false),
TwoLetterISOCode = table.Column<string>(type: "varchar(2)", nullable: false),
ThreeLetterISOCode = table.Column<string>(type: "varchar(3)", nullable: false),
NumericISOCode = table.Column<int>(type: "integer", nullable: false),
AllowShipping = table.Column<bool>(type: "boolean", nullable: false),
Enabled = table.Column<bool>(type: "boolean", nullable: false),
DisplayOrder = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Countries", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Currencies",
columns: table => new
@@ -200,7 +219,7 @@ namespace Atomx.Data.Migrations
Id = table.Column<long>(type: "bigint", nullable: false),
Title = table.Column<string>(type: "text", nullable: false),
CurrencyId = table.Column<int>(type: "integer", nullable: false),
PayChannelId = table.Column<int>(type: "integer", nullable: false),
ChannelId = table.Column<int>(type: "integer", nullable: false),
StartTime = table.Column<int>(type: "integer", nullable: false),
EndTime = table.Column<int>(type: "integer", nullable: false),
TimeZone = table.Column<int>(type: "integer", nullable: false),
@@ -256,7 +275,7 @@ namespace Atomx.Data.Migrations
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false),
LanguageNumber = table.Column<int>(type: "integer", nullable: false),
LanguageId = table.Column<int>(type: "integer", nullable: false),
Type = table.Column<int>(type: "integer", nullable: false),
EntityId = table.Column<long>(type: "bigint", nullable: false),
Key = table.Column<string>(type: "varchar(256)", nullable: false),
@@ -633,6 +652,23 @@ namespace Atomx.Data.Migrations
table.PrimaryKey("PK_SpecificationAttributes", x => x.Id);
});
migrationBuilder.CreateTable(
name: "StateProvinces",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false),
Name = table.Column<string>(type: "varchar(256)", nullable: false),
CountryId = table.Column<long>(type: "bigint", nullable: false),
Initial = table.Column<string>(type: "varchar(1)", nullable: false),
Abbreviation = table.Column<string>(type: "varchar(32)", nullable: false),
Enabled = table.Column<bool>(type: "boolean", nullable: false),
DisplayOrder = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_StateProvinces", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Tags",
columns: table => new
@@ -718,6 +754,9 @@ namespace Atomx.Data.Migrations
migrationBuilder.DropTable(
name: "Channels");
migrationBuilder.DropTable(
name: "Countries");
migrationBuilder.DropTable(
name: "Currencies");
@@ -784,6 +823,9 @@ namespace Atomx.Data.Migrations
migrationBuilder.DropTable(
name: "SpecificationAttributes");
migrationBuilder.DropTable(
name: "StateProvinces");
migrationBuilder.DropTable(
name: "Tags");

View File

@@ -239,6 +239,9 @@ namespace Atomx.Data.Migrations
b.Property<bool>("AllowShipping")
.HasColumnType("boolean");
b.Property<long>("CountryId")
.HasColumnType("bigint");
b.Property<int>("DisplayOrder")
.HasColumnType("integer");
@@ -253,19 +256,11 @@ namespace Atomx.Data.Migrations
.IsRequired()
.HasColumnType("varchar(256)");
b.Property<int>("NumericISOCode")
.HasColumnType("integer");
b.Property<long>("ParentId")
.HasColumnType("bigint");
b.Property<string>("ThreeLetterISOCode")
.IsRequired()
.HasColumnType("varchar(3)");
b.Property<string>("TwoLetterISOCode")
.IsRequired()
.HasColumnType("varchar(2)");
b.Property<long>("StateProvinceId")
.HasColumnType("bigint");
b.HasKey("Id");
@@ -347,8 +342,11 @@ namespace Atomx.Data.Migrations
modelBuilder.Entity("Atomx.Common.Entities.Channel", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Config")
.IsRequired()
.HasColumnType("text");
@@ -391,6 +389,44 @@ namespace Atomx.Data.Migrations
b.ToTable("Channels");
});
modelBuilder.Entity("Atomx.Common.Entities.Country", b =>
{
b.Property<long>("Id")
.HasColumnType("bigint");
b.Property<bool>("AllowShipping")
.HasColumnType("boolean");
b.Property<int>("DisplayOrder")
.HasColumnType("integer");
b.Property<bool>("Enabled")
.HasColumnType("boolean");
b.Property<string>("Initial")
.IsRequired()
.HasColumnType("varchar(1)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("varchar(256)");
b.Property<int>("NumericISOCode")
.HasColumnType("integer");
b.Property<string>("ThreeLetterISOCode")
.IsRequired()
.HasColumnType("varchar(3)");
b.Property<string>("TwoLetterISOCode")
.IsRequired()
.HasColumnType("varchar(2)");
b.HasKey("Id");
b.ToTable("Countries");
});
modelBuilder.Entity("Atomx.Common.Entities.Currency", b =>
{
b.Property<int>("Id")
@@ -457,6 +493,9 @@ namespace Atomx.Data.Migrations
b.Property<long>("Id")
.HasColumnType("bigint");
b.Property<int>("ChannelId")
.HasColumnType("integer");
b.Property<DateTime>("CreateTime")
.HasColumnType("timestamptz");
@@ -470,9 +509,6 @@ namespace Atomx.Data.Migrations
.IsRequired()
.HasColumnType("text");
b.Property<int>("PayChannelId")
.HasColumnType("integer");
b.Property<decimal>("Rate")
.HasColumnType("numeric");
@@ -578,7 +614,7 @@ namespace Atomx.Data.Migrations
.IsRequired()
.HasColumnType("varchar(256)");
b.Property<int>("LanguageNumber")
b.Property<int>("LanguageId")
.HasColumnType("integer");
b.Property<int>("Type")
@@ -1336,6 +1372,37 @@ namespace Atomx.Data.Migrations
b.ToTable("SpecificationAttributeOptions");
});
modelBuilder.Entity("Atomx.Common.Entities.StateProvince", b =>
{
b.Property<long>("Id")
.HasColumnType("bigint");
b.Property<string>("Abbreviation")
.IsRequired()
.HasColumnType("varchar(32)");
b.Property<long>("CountryId")
.HasColumnType("bigint");
b.Property<int>("DisplayOrder")
.HasColumnType("integer");
b.Property<bool>("Enabled")
.HasColumnType("boolean");
b.Property<string>("Initial")
.IsRequired()
.HasColumnType("varchar(1)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("varchar(256)");
b.HasKey("Id");
b.ToTable("StateProvinces");
});
modelBuilder.Entity("Atomx.Common.Entities.Tag", b =>
{
b.Property<long>("Id")