调整数据库结构,实现消息模板管理

This commit is contained in:
2025-12-16 11:26:55 +08:00
parent 98e3f7ab73
commit ed32b98867
45 changed files with 1100 additions and 1319 deletions

View File

@@ -0,0 +1,774 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Atomx.Data.Migrations
{
/// <inheritdoc />
public partial class _01 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Addresses",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false),
UserId = table.Column<long>(type: "bigint", nullable: false),
Name = table.Column<string>(type: "varchar(128)", nullable: false),
Email = table.Column<string>(type: "varchar(256)", nullable: false),
Phone = table.Column<string>(type: "varchar(20)", nullable: false),
Company = table.Column<string>(type: "varchar(256)", nullable: false),
CountryId = table.Column<long>(type: "bigint", nullable: false),
Country = table.Column<string>(type: "varchar(50)", nullable: false),
ProvinceId = table.Column<long>(type: "bigint", nullable: false),
Province = table.Column<string>(type: "varchar(100)", nullable: false),
CityId = table.Column<long>(type: "bigint", nullable: false),
City = table.Column<string>(type: "varchar(100)", nullable: false),
RegionId = table.Column<long>(type: "bigint", nullable: false),
Region = table.Column<string>(type: "varchar(100)", nullable: false),
PostalCode = table.Column<string>(type: "varchar(15)", nullable: false),
AddressDetails = table.Column<string>(type: "varchar(256)", nullable: false),
FullAddress = table.Column<string>(type: "varchar(1024)", nullable: false),
Longitude = table.Column<decimal>(type: "numeric(10,6)", nullable: false),
Latitude = table.Column<decimal>(type: "numeric(10,6)", nullable: false),
IsVirtual = table.Column<bool>(type: "boolean", nullable: false),
Count = table.Column<int>(type: "integer", nullable: false),
IsDelete = table.Column<bool>(type: "boolean", nullable: false),
CreateTime = table.Column<DateTime>(type: "timestamptz", nullable: false),
UpdateTime = table.Column<DateTime>(type: "timestamptz", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Addresses", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Admins",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false),
Username = table.Column<string>(type: "varchar(64)", nullable: false),
Password = table.Column<string>(type: "varchar(64)", nullable: false),
Email = table.Column<string>(type: "varchar(64)", nullable: false),
Mobile = table.Column<string>(type: "varchar(64)", nullable: false),
Avatar = table.Column<string>(type: "varchar(64)", nullable: false),
RoleId = table.Column<int>(type: "integer", nullable: false),
TimeOffset = table.Column<string>(type: "varchar(4)", nullable: false),
Status = table.Column<int>(type: "integer", nullable: false),
LoginCount = table.Column<int>(type: "integer", nullable: false),
LastLogin = table.Column<DateTime>(type: "timestamptz", nullable: true),
LastIp = table.Column<string>(type: "varchar(50)", nullable: false),
LockoutEndTime = table.Column<DateTime>(type: "timestamptz", nullable: true),
CreateTime = table.Column<DateTime>(type: "timestamptz", nullable: false),
UpdateTime = table.Column<DateTime>(type: "timestamptz", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Admins", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AppVersions",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false),
SiteId = table.Column<long>(type: "bigint", nullable: false),
Platform = table.Column<int>(type: "integer", nullable: false),
AppName = table.Column<string>(type: "varchar(64)", nullable: false),
Title = table.Column<string>(type: "varchar(64)", nullable: false),
Version = table.Column<string>(type: "varchar(64)", nullable: false),
VersionX = table.Column<string>(type: "varchar(64)", nullable: false),
VersionY = table.Column<string>(type: "varchar(64)", nullable: false),
VersionZ = table.Column<string>(type: "varchar(64)", nullable: false),
VersionDate = table.Column<string>(type: "varchar(64)", nullable: false),
VersionState = table.Column<int>(type: "integer", nullable: false),
Content = table.Column<string>(type: "text", nullable: false),
Status = table.Column<int>(type: "integer", nullable: false),
CreateTime = table.Column<DateTime>(type: "timestamptz", nullable: false),
UpdateTime = table.Column<DateTime>(type: "timestamptz", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AppVersions", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Areas",
columns: table => new
{
Id = 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)
},
constraints: table =>
{
table.PrimaryKey("PK_Areas", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Categories",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false),
SiteId = table.Column<long>(type: "bigint", nullable: false),
Type = table.Column<int>(type: "integer", nullable: false),
ParentId = table.Column<long>(type: "bigint", nullable: false),
Name = table.Column<string>(type: "varchar(25)", nullable: false),
Slug = table.Column<string>(type: "varchar(50)", nullable: false),
MetaDescription = table.Column<string>(type: "varchar(256)", nullable: false),
MetaKeywords = table.Column<string>(type: "varchar(256)", nullable: false),
FilterAttributes = table.Column<string>(type: "varchar(256)", nullable: false),
Image = table.Column<string>(type: "varchar(256)", nullable: false),
Banner = table.Column<string>(type: "varchar(256)", nullable: false),
IsNode = table.Column<bool>(type: "boolean", nullable: false),
Enabled = table.Column<bool>(type: "boolean", nullable: false),
Depth = table.Column<int>(type: "integer", nullable: false),
Path = table.Column<string>(type: "varchar(100)", nullable: false),
DisplayOrder = table.Column<int>(type: "integer", nullable: false),
Count = table.Column<int>(type: "integer", nullable: false),
CreateTime = table.Column<DateTime>(type: "timestamptz", nullable: false),
UpdateTime = table.Column<DateTime>(type: "timestamptz", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Categories", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Channels",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false),
SiteId = table.Column<long>(type: "bigint", nullable: false),
Type = table.Column<int>(type: "integer", nullable: false),
Network = table.Column<int>(type: "integer", nullable: false),
Name = table.Column<string>(type: "varchar(20)", nullable: false),
Title = table.Column<string>(type: "varchar(20)", nullable: false),
Description = table.Column<string>(type: "varchar(512)", nullable: false),
Config = table.Column<string>(type: "text", nullable: false),
DisplayOrder = table.Column<int>(type: "integer", nullable: false),
Status = table.Column<int>(type: "integer", nullable: false),
CreateTime = table.Column<DateTime>(type: "timestamptz", nullable: false),
UpdateTime = table.Column<DateTime>(type: "timestamptz", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Channels", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Currencies",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false),
SiteId = table.Column<long>(type: "bigint", nullable: false),
Name = table.Column<string>(type: "varchar(50)", nullable: false),
Title = table.Column<string>(type: "varchar(50)", nullable: false),
CurrencyCode = table.Column<string>(type: "varchar(10)", nullable: false),
DisplayLocale = table.Column<string>(type: "varchar(15)", nullable: false),
Symbolic = table.Column<string>(type: "varchar(8)", nullable: false),
CustomFormatting = table.Column<string>(type: "varchar(20)", nullable: false),
Rate = table.Column<decimal>(type: "numeric(16,4)", nullable: false),
DisplayOrder = table.Column<int>(type: "integer", nullable: false),
EnableDisplay = table.Column<bool>(type: "boolean", nullable: false),
EnablePay = table.Column<bool>(type: "boolean", nullable: false),
Enabled = table.Column<bool>(type: "boolean", nullable: false),
CreateTime = table.Column<DateTime>(type: "timestamptz", nullable: false),
UpdateTime = table.Column<DateTime>(type: "timestamptz", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Currencies", x => x.Id);
});
migrationBuilder.CreateTable(
name: "CurrencyChannelRelations",
columns: table => new
{
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),
StartTime = table.Column<int>(type: "integer", nullable: false),
EndTime = table.Column<int>(type: "integer", nullable: false),
TimeZone = table.Column<int>(type: "integer", nullable: false),
Rate = table.Column<decimal>(type: "numeric", nullable: false),
Extended = table.Column<string>(type: "text", nullable: false),
Status = table.Column<int>(type: "integer", nullable: false),
CreateTime = table.Column<DateTime>(type: "timestamptz", nullable: false),
UpdateTime = table.Column<DateTime>(type: "timestamptz", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_CurrencyChannelRelations", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Languages",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column<string>(type: "varchar(50)", nullable: false),
Title = table.Column<string>(type: "varchar(50)", nullable: false),
Culture = table.Column<string>(type: "varchar(25)", nullable: false),
FlagImage = table.Column<string>(type: "varchar(256)", nullable: false),
DisplayOrder = table.Column<int>(type: "integer", nullable: false),
Enabled = table.Column<bool>(type: "boolean", nullable: false),
ResourceVersion = table.Column<string>(type: "varchar(256)", nullable: false),
CreateTime = table.Column<DateTime>(type: "timestamptz", nullable: false),
UpdateTime = table.Column<DateTime>(type: "timestamptz", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Languages", x => x.Id);
});
migrationBuilder.CreateTable(
name: "LocaleResources",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false),
LanguageId = table.Column<int>(type: "integer", nullable: false),
Name = table.Column<string>(type: "varchar(256)", nullable: false),
Value = table.Column<string>(type: "varchar(1000)", nullable: false),
UpdateTime = table.Column<DateTime>(type: "timestamptz", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_LocaleResources", x => x.Id);
});
migrationBuilder.CreateTable(
name: "LocalizedProperties",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false),
LanguageNumber = 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),
Value = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_LocalizedProperties", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Menus",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false),
Type = table.Column<int>(type: "integer", nullable: false),
ParentId = table.Column<long>(type: "bigint", nullable: false),
Name = table.Column<string>(type: "varchar(50)", nullable: false),
Icon = table.Column<string>(type: "varchar(256)", nullable: false),
Key = table.Column<string>(type: "varchar(50)", nullable: false),
Url = table.Column<string>(type: "varchar(256)", nullable: false),
Code = table.Column<string>(type: "varchar(50)", nullable: false),
IsLink = table.Column<bool>(type: "boolean", nullable: false),
Enabled = table.Column<bool>(type: "boolean", nullable: false),
Depth = table.Column<int>(type: "integer", nullable: false),
Path = table.Column<string>(type: "varchar(100)", nullable: false),
DisplayOrder = table.Column<int>(type: "integer", nullable: false),
CreateTime = table.Column<DateTime>(type: "timestamptz", nullable: false),
UpdateTime = table.Column<DateTime>(type: "timestamptz", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Menus", x => x.Id);
});
migrationBuilder.CreateTable(
name: "MessageTemplates",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false),
SiteId = table.Column<long>(type: "bigint", nullable: false),
LanguageId = table.Column<int>(type: "integer", nullable: false),
Type = table.Column<int>(type: "integer", nullable: false),
Key = table.Column<string>(type: "varchar(64)", nullable: false),
Name = table.Column<string>(type: "varchar(256)", nullable: false),
Title = table.Column<string>(type: "varchar(256)", nullable: false),
Body = table.Column<string>(type: "text", nullable: false),
Attachments = table.Column<string>(type: "varchar(1024)", nullable: false),
Enabled = table.Column<bool>(type: "boolean", nullable: false),
CreateTime = table.Column<DateTime>(type: "timestamptz", nullable: false),
UpdateTime = table.Column<DateTime>(type: "timestamptz", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_MessageTemplates", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Permissions",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false),
Name = table.Column<string>(type: "varchar(128)", nullable: false),
Description = table.Column<string>(type: "varchar(256)", nullable: false),
Category = table.Column<string>(type: "varchar(128)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Permissions", x => x.Id);
});
migrationBuilder.CreateTable(
name: "ProductAttributeCombinations",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false),
ProductId = table.Column<long>(type: "bigint", nullable: false),
CorporationId = table.Column<long>(type: "bigint", nullable: false),
ManufacturerId = table.Column<long>(type: "bigint", nullable: false),
AttributesJson = table.Column<string>(type: "text", nullable: false),
StockQuantity = table.Column<int>(type: "integer", nullable: false),
SalesQuantity = table.Column<int>(type: "integer", nullable: false),
SkuNumber = table.Column<string>(type: "varchar(20)", nullable: false),
Weight = table.Column<decimal>(type: "numeric(18,4)", nullable: false),
WeightUnit = table.Column<int>(type: "integer", nullable: false),
ProcessCharge = table.Column<decimal>(type: "numeric(18,4)", nullable: false),
ProcessCost = table.Column<decimal>(type: "numeric(18,4)", nullable: false),
Surcharge = table.Column<decimal>(type: "numeric(18,4)", nullable: false),
SurchargeCost = table.Column<decimal>(type: "numeric(18,4)", nullable: false),
MarketPrice = table.Column<decimal>(type: "numeric(18,4)", nullable: false),
Price = table.Column<decimal>(type: "numeric(18,4)", nullable: false),
Mark = table.Column<int>(type: "integer", nullable: false),
Note = table.Column<string>(type: "varchar(256)", nullable: false),
Enabled = table.Column<bool>(type: "boolean", nullable: false),
UpdateTime = table.Column<DateTime>(type: "timestamptz", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ProductAttributeCombinations", x => x.Id);
});
migrationBuilder.CreateTable(
name: "ProductAttributeOptions",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false),
AttributeId = table.Column<long>(type: "bigint", nullable: false),
Value = table.Column<string>(type: "varchar(50)", nullable: false),
Count = table.Column<int>(type: "integer", nullable: false),
DisplayOrder = table.Column<int>(type: "integer", nullable: false),
Standard = table.Column<bool>(type: "boolean", nullable: false),
Status = table.Column<int>(type: "integer", nullable: false),
CreateTime = table.Column<DateTime>(type: "timestamptz", nullable: false),
UpdateTime = table.Column<DateTime>(type: "timestamptz", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ProductAttributeOptions", x => x.Id);
});
migrationBuilder.CreateTable(
name: "ProductAttributeRelations",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false),
ProductId = table.Column<long>(type: "bigint", nullable: false),
AttributeId = table.Column<long>(type: "bigint", nullable: false),
Image = table.Column<bool>(type: "boolean", nullable: false),
DisplayOrder = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ProductAttributeRelations", x => x.Id);
});
migrationBuilder.CreateTable(
name: "ProductAttributes",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false),
CategoryId = table.Column<long>(type: "bigint", nullable: false),
ParentId = table.Column<long>(type: "bigint", nullable: false),
Name = table.Column<string>(type: "varchar(50)", nullable: false),
WeightIsRequired = table.Column<bool>(type: "boolean", nullable: false),
WeightUnit = table.Column<int>(type: "integer", nullable: false),
ControlType = table.Column<int>(type: "integer", nullable: false),
Count = table.Column<int>(type: "integer", nullable: false),
DisplayOrder = table.Column<int>(type: "integer", nullable: false),
IsRequired = table.Column<bool>(type: "boolean", nullable: false),
Status = table.Column<int>(type: "integer", nullable: false),
CreateTime = table.Column<DateTime>(type: "timestamptz", nullable: false),
UpdateTime = table.Column<DateTime>(type: "timestamptz", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ProductAttributes", x => x.Id);
});
migrationBuilder.CreateTable(
name: "ProductAttributeValues",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false),
ProductId = table.Column<long>(type: "bigint", nullable: false),
OptionId = table.Column<long>(type: "bigint", nullable: false),
ProductAttributeRelationId = table.Column<long>(type: "bigint", nullable: false),
Name = table.Column<string>(type: "varchar(50)", nullable: false),
Image = table.Column<string>(type: "varchar(256)", nullable: false),
Weight = table.Column<decimal>(type: "numeric(18,4)", nullable: false),
WeightUnit = table.Column<int>(type: "integer", nullable: false),
IsAddWeight = table.Column<bool>(type: "boolean", nullable: false),
DisplayOrder = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ProductAttributeValues", x => x.Id);
});
migrationBuilder.CreateTable(
name: "ProductInventories",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false),
CorporationId = table.Column<long>(type: "bigint", nullable: false),
ProductId = table.Column<long>(type: "bigint", nullable: false),
ProductAttributeCombinationId = table.Column<long>(type: "bigint", nullable: false),
WarehouseId = table.Column<long>(type: "bigint", nullable: false),
StockQuantity = table.Column<int>(type: "integer", nullable: false),
CreateTime = table.Column<DateTime>(type: "timestamptz", nullable: false),
UpdateTime = table.Column<DateTime>(type: "timestamptz", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ProductInventories", x => x.Id);
});
migrationBuilder.CreateTable(
name: "ProductInventoryLogs",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false),
Operator = table.Column<long>(type: "bigint", nullable: true),
Type = table.Column<int>(type: "integer", nullable: true),
ProductId = table.Column<long>(type: "bigint", nullable: false),
StoreId = table.Column<long>(type: "bigint", nullable: false),
CorporationId = table.Column<long>(type: "bigint", nullable: false),
ManufacturerId = table.Column<long>(type: "bigint", nullable: false),
WarehouseId = table.Column<long>(type: "bigint", nullable: false),
ProductAttributeCombinationId = table.Column<long>(type: "bigint", nullable: false),
OrderId = table.Column<long>(type: "bigint", nullable: false),
ChangeAmount = table.Column<int>(type: "integer", nullable: false),
Weight = table.Column<decimal>(type: "numeric(18,4)", nullable: false),
BeforeStock = table.Column<int>(type: "integer", nullable: false),
AfterStock = table.Column<int>(type: "integer", nullable: false),
Note = table.Column<string>(type: "varchar(256)", nullable: false),
CreateTime = table.Column<DateTime>(type: "timestamptz", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ProductInventoryLogs", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Products",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false),
CorporationStaffId = table.Column<long>(type: "bigint", nullable: false),
CorporationId = table.Column<long>(type: "bigint", nullable: false),
StoreId = table.Column<long>(type: "bigint", nullable: false),
ProductTypeId = table.Column<long>(type: "bigint", nullable: false),
CategoryPath = table.Column<string>(type: "varchar(200)", nullable: true),
CategoryId = table.Column<long>(type: "bigint", nullable: false),
ManufacturerId = table.Column<long>(type: "bigint", nullable: false),
Title = table.Column<string>(type: "varchar(256)", nullable: false),
SIN = table.Column<string>(type: "varchar(20)", nullable: true),
Image = table.Column<string>(type: "varchar(256)", nullable: true),
Photos = table.Column<string>(type: "text", nullable: true),
Feature = table.Column<string>(type: "varchar(256)", nullable: true),
Description = table.Column<string>(type: "varchar(256)", nullable: true),
SpecificationJson = table.Column<string>(type: "text", nullable: true),
Weight = table.Column<decimal>(type: "numeric(6,2)", nullable: true),
MinWeight = table.Column<decimal>(type: "numeric(6,2)", nullable: true),
MaxWeight = table.Column<decimal>(type: "numeric(6,2)", nullable: true),
MarketPrice = table.Column<decimal>(type: "numeric(18,4)", nullable: false),
Price = table.Column<decimal>(type: "numeric(18,4)", nullable: false),
SkuPrices = table.Column<string>(type: "text", nullable: true),
Extended = table.Column<string>(type: "text", nullable: false),
DisplayOrder = table.Column<int>(type: "integer", nullable: false),
ReviewStatus = table.Column<int>(type: "integer", nullable: false),
InventoryMethod = table.Column<int>(type: "integer", nullable: false),
StockQuantity = table.Column<int>(type: "integer", nullable: false),
SalesQuantity = table.Column<int>(type: "integer", nullable: false),
PictureCount = table.Column<int>(type: "integer", nullable: false),
Status = table.Column<int>(type: "integer", nullable: false),
Deleted = table.Column<bool>(type: "boolean", nullable: false),
DeletedTime = table.Column<DateTime>(type: "timestamptz", nullable: true),
CreateTime = table.Column<DateTime>(type: "timestamptz", nullable: false),
UpdateTime = table.Column<DateTime>(type: "timestamptz", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Products", x => x.Id);
});
migrationBuilder.CreateTable(
name: "RefreshTokens",
columns: table => new
{
Id = table.Column<string>(type: "text", nullable: false),
UserId = table.Column<long>(type: "bigint", nullable: false),
Token = table.Column<string>(type: "varchar(500)", nullable: false),
IssuedTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
ExpiresTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
IsRevoked = table.Column<bool>(type: "boolean", nullable: false),
RevokedTime = table.Column<DateTime>(type: "timestamptz", nullable: true),
Ip = table.Column<string>(type: "varchar(50)", nullable: false),
UserAgent = table.Column<string>(type: "varchar(500)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_RefreshTokens", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Roles",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Type = table.Column<int>(type: "integer", nullable: false),
Name = table.Column<string>(type: "text", nullable: false),
Description = table.Column<string>(type: "varchar(256)", nullable: false),
Permission = table.Column<string>(type: "text", nullable: false),
IsSystemRole = table.Column<bool>(type: "boolean", nullable: false),
Count = table.Column<int>(type: "integer", nullable: false),
Enabled = table.Column<bool>(type: "boolean", nullable: false),
CreateTime = table.Column<DateTime>(type: "timestamptz", nullable: false),
UpdateTime = table.Column<DateTime>(type: "timestamptz", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Roles", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Settings",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false),
SiteId = table.Column<long>(type: "bigint", nullable: false),
Type = table.Column<int>(type: "integer", nullable: false),
Name = table.Column<string>(type: "varchar(64)", nullable: false),
Key = table.Column<string>(type: "varchar(64)", nullable: false),
Content = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Settings", x => x.Id);
});
migrationBuilder.CreateTable(
name: "SiteApps",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false),
Type = table.Column<int>(type: "integer", nullable: false),
Name = table.Column<string>(type: "varchar(64)", nullable: false),
Enabled = table.Column<bool>(type: "boolean", nullable: false),
CreateTime = table.Column<DateTime>(type: "timestamptz", nullable: false),
UpdateTime = table.Column<DateTime>(type: "timestamptz", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_SiteApps", x => x.Id);
});
migrationBuilder.CreateTable(
name: "SpecificationAttributeOptions",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false),
SpecificationId = table.Column<long>(type: "bigint", nullable: false),
Value = table.Column<string>(type: "varchar(50)", nullable: false),
Count = table.Column<int>(type: "integer", nullable: false),
DisplayOrder = table.Column<int>(type: "integer", nullable: false),
Status = table.Column<int>(type: "integer", nullable: false),
CreateTime = table.Column<DateTime>(type: "timestamptz", nullable: false),
UpdateTime = table.Column<DateTime>(type: "timestamptz", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_SpecificationAttributeOptions", x => x.Id);
});
migrationBuilder.CreateTable(
name: "SpecificationAttributes",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false),
CategoryId = table.Column<long>(type: "bigint", nullable: false),
ParentId = table.Column<long>(type: "bigint", nullable: false),
Name = table.Column<string>(type: "varchar(50)", nullable: false),
ControlType = table.Column<int>(type: "integer", nullable: false),
Count = table.Column<int>(type: "integer", nullable: false),
DisplayOrder = table.Column<int>(type: "integer", nullable: false),
Status = table.Column<int>(type: "integer", nullable: false),
CreateTime = table.Column<DateTime>(type: "timestamptz", nullable: false),
UpdateTime = table.Column<DateTime>(type: "timestamptz", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_SpecificationAttributes", x => x.Id);
});
migrationBuilder.CreateTable(
name: "UploadFiles",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false),
SiteId = table.Column<long>(type: "bigint", nullable: false),
Type = table.Column<int>(type: "integer", nullable: false),
Name = table.Column<string>(type: "varchar(64)", nullable: false),
Path = table.Column<string>(type: "varchar(128)", nullable: false),
Extension = table.Column<string>(type: "varchar(12)", nullable: false),
ContentType = table.Column<string>(type: "varchar(32)", nullable: false),
SHA256Hash = table.Column<string>(type: "varchar(128)", nullable: false),
Size = table.Column<int>(type: "integer", nullable: false),
CreateUid = table.Column<long>(type: "bigint", nullable: false),
CreateBy = table.Column<string>(type: "varchar(32)", nullable: false),
CreateTime = table.Column<DateTime>(type: "timestamptz", nullable: false),
UpdateTime = table.Column<DateTime>(type: "timestamptz", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_UploadFiles", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Users",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false),
Name = table.Column<string>(type: "varchar(64)", nullable: false),
Email = table.Column<string>(type: "varchar(128)", nullable: false),
Mobile = table.Column<string>(type: "varchar(32)", nullable: false),
Avatar = table.Column<string>(type: "varchar(64)", nullable: false),
Password = table.Column<string>(type: "varchar(32)", nullable: false),
IsActive = table.Column<bool>(type: "boolean", nullable: false),
EmailConfirmed = table.Column<bool>(type: "boolean", nullable: false),
LockoutEndTime = table.Column<DateTime>(type: "timestamptz", nullable: true),
FailedLoginAttempts = table.Column<int>(type: "integer", nullable: false),
CreateTime = table.Column<DateTime>(type: "timestamptz", nullable: false),
UpdateTime = table.Column<DateTime>(type: "timestamptz", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Users", x => x.Id);
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Addresses");
migrationBuilder.DropTable(
name: "Admins");
migrationBuilder.DropTable(
name: "AppVersions");
migrationBuilder.DropTable(
name: "Areas");
migrationBuilder.DropTable(
name: "Categories");
migrationBuilder.DropTable(
name: "Channels");
migrationBuilder.DropTable(
name: "Currencies");
migrationBuilder.DropTable(
name: "CurrencyChannelRelations");
migrationBuilder.DropTable(
name: "Languages");
migrationBuilder.DropTable(
name: "LocaleResources");
migrationBuilder.DropTable(
name: "LocalizedProperties");
migrationBuilder.DropTable(
name: "Menus");
migrationBuilder.DropTable(
name: "MessageTemplates");
migrationBuilder.DropTable(
name: "Permissions");
migrationBuilder.DropTable(
name: "ProductAttributeCombinations");
migrationBuilder.DropTable(
name: "ProductAttributeOptions");
migrationBuilder.DropTable(
name: "ProductAttributeRelations");
migrationBuilder.DropTable(
name: "ProductAttributes");
migrationBuilder.DropTable(
name: "ProductAttributeValues");
migrationBuilder.DropTable(
name: "ProductInventories");
migrationBuilder.DropTable(
name: "ProductInventoryLogs");
migrationBuilder.DropTable(
name: "Products");
migrationBuilder.DropTable(
name: "RefreshTokens");
migrationBuilder.DropTable(
name: "Roles");
migrationBuilder.DropTable(
name: "Settings");
migrationBuilder.DropTable(
name: "SiteApps");
migrationBuilder.DropTable(
name: "SpecificationAttributeOptions");
migrationBuilder.DropTable(
name: "SpecificationAttributes");
migrationBuilder.DropTable(
name: "UploadFiles");
migrationBuilder.DropTable(
name: "Users");
}
}
}