using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Atomx.Data.Migrations
{
///
public partial class _01 : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Addresses",
columns: table => new
{
Id = table.Column(type: "bigint", nullable: false),
UserId = table.Column(type: "bigint", nullable: false),
Name = table.Column(type: "varchar(128)", nullable: false),
Email = table.Column(type: "varchar(256)", nullable: false),
Phone = table.Column(type: "varchar(20)", nullable: false),
Company = table.Column(type: "varchar(256)", nullable: false),
CountryId = table.Column(type: "bigint", nullable: false),
Country = table.Column(type: "varchar(50)", nullable: false),
ProvinceId = table.Column(type: "bigint", nullable: false),
Province = table.Column(type: "varchar(100)", nullable: false),
CityId = table.Column(type: "bigint", nullable: false),
City = table.Column(type: "varchar(100)", nullable: false),
RegionId = table.Column(type: "bigint", nullable: false),
Region = table.Column(type: "varchar(100)", nullable: false),
PostalCode = table.Column(type: "varchar(15)", nullable: false),
AddressDetails = table.Column(type: "varchar(256)", nullable: false),
FullAddress = table.Column(type: "varchar(1024)", nullable: false),
Longitude = table.Column(type: "numeric(10,6)", nullable: false),
Latitude = table.Column(type: "numeric(10,6)", nullable: false),
IsVirtual = table.Column(type: "boolean", nullable: false),
Count = table.Column(type: "integer", nullable: false),
IsDelete = table.Column(type: "boolean", nullable: false),
CreateTime = table.Column(type: "timestamptz", nullable: false),
UpdateTime = table.Column(type: "timestamptz", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Addresses", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Admins",
columns: table => new
{
Id = table.Column(type: "bigint", nullable: false),
Username = table.Column(type: "varchar(64)", nullable: false),
Password = table.Column(type: "varchar(64)", nullable: false),
Email = table.Column(type: "varchar(64)", nullable: false),
Mobile = table.Column(type: "varchar(64)", nullable: false),
Avatar = table.Column(type: "varchar(64)", nullable: false),
RoleId = table.Column(type: "integer", nullable: false),
TimeOffset = table.Column(type: "varchar(4)", nullable: false),
Status = table.Column(type: "integer", nullable: false),
LoginCount = table.Column(type: "integer", nullable: false),
LastLogin = table.Column(type: "timestamptz", nullable: true),
LastIp = table.Column(type: "varchar(50)", nullable: false),
LockoutEndTime = table.Column(type: "timestamptz", nullable: true),
CreateTime = table.Column(type: "timestamptz", nullable: false),
UpdateTime = table.Column(type: "timestamptz", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Admins", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AppVersions",
columns: table => new
{
Id = table.Column(type: "bigint", nullable: false),
SiteId = table.Column(type: "bigint", nullable: false),
Platform = table.Column(type: "integer", nullable: false),
AppName = table.Column(type: "varchar(64)", nullable: false),
Title = table.Column(type: "varchar(64)", nullable: false),
Version = table.Column(type: "varchar(64)", nullable: false),
VersionX = table.Column(type: "varchar(64)", nullable: false),
VersionY = table.Column(type: "varchar(64)", nullable: false),
VersionZ = table.Column(type: "varchar(64)", nullable: false),
VersionDate = table.Column(type: "varchar(64)", nullable: false),
VersionState = table.Column(type: "integer", nullable: false),
Content = table.Column(type: "text", nullable: false),
Status = table.Column(type: "integer", nullable: false),
CreateTime = table.Column(type: "timestamptz", nullable: false),
UpdateTime = table.Column(type: "timestamptz", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AppVersions", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Areas",
columns: table => new
{
Id = table.Column(type: "bigint", nullable: false),
ParentId = table.Column(type: "bigint", nullable: false),
Name = table.Column(type: "varchar(256)", nullable: false),
Initial = table.Column(type: "varchar(1)", nullable: false),
TwoLetterISOCode = table.Column(type: "varchar(2)", nullable: false),
ThreeLetterISOCode = table.Column(type: "varchar(3)", nullable: false),
NumericISOCode = table.Column(type: "integer", nullable: false),
AllowShipping = table.Column(type: "boolean", nullable: false),
Enabled = table.Column(type: "boolean", nullable: false),
DisplayOrder = table.Column(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Areas", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Categories",
columns: table => new
{
Id = table.Column(type: "bigint", nullable: false),
SiteId = table.Column(type: "bigint", nullable: false),
Type = table.Column(type: "integer", nullable: false),
ParentId = table.Column(type: "bigint", nullable: false),
Name = table.Column(type: "varchar(25)", nullable: false),
Slug = table.Column(type: "varchar(50)", nullable: false),
MetaDescription = table.Column(type: "varchar(256)", nullable: false),
MetaKeywords = table.Column(type: "varchar(256)", nullable: false),
FilterAttributes = table.Column(type: "varchar(256)", nullable: false),
Image = table.Column(type: "varchar(256)", nullable: false),
Banner = table.Column(type: "varchar(256)", nullable: false),
IsNode = table.Column(type: "boolean", nullable: false),
Enabled = table.Column(type: "boolean", nullable: false),
Depth = table.Column(type: "integer", nullable: false),
Path = table.Column(type: "varchar(100)", nullable: false),
DisplayOrder = table.Column(type: "integer", nullable: false),
Count = table.Column(type: "integer", nullable: false),
CreateTime = table.Column(type: "timestamptz", nullable: false),
UpdateTime = table.Column(type: "timestamptz", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Categories", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Channels",
columns: table => new
{
Id = table.Column(type: "integer", nullable: false),
SiteId = table.Column(type: "bigint", nullable: false),
Type = table.Column(type: "integer", nullable: false),
Network = table.Column(type: "integer", nullable: false),
Name = table.Column(type: "varchar(20)", nullable: false),
Title = table.Column(type: "varchar(20)", nullable: false),
Description = table.Column(type: "varchar(512)", nullable: false),
Config = table.Column(type: "text", nullable: false),
DisplayOrder = table.Column(type: "integer", nullable: false),
Status = table.Column(type: "integer", nullable: false),
CreateTime = table.Column(type: "timestamptz", nullable: false),
UpdateTime = table.Column(type: "timestamptz", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Channels", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Currencies",
columns: table => new
{
Id = table.Column(type: "integer", nullable: false),
SiteId = table.Column(type: "bigint", nullable: false),
Name = table.Column(type: "varchar(50)", nullable: false),
Title = table.Column(type: "varchar(50)", nullable: false),
CurrencyCode = table.Column(type: "varchar(10)", nullable: false),
DisplayLocale = table.Column(type: "varchar(15)", nullable: false),
Symbolic = table.Column(type: "varchar(8)", nullable: false),
CustomFormatting = table.Column(type: "varchar(20)", nullable: false),
Rate = table.Column(type: "numeric(16,4)", nullable: false),
DisplayOrder = table.Column(type: "integer", nullable: false),
EnableDisplay = table.Column(type: "boolean", nullable: false),
EnablePay = table.Column(type: "boolean", nullable: false),
Enabled = table.Column(type: "boolean", nullable: false),
CreateTime = table.Column(type: "timestamptz", nullable: false),
UpdateTime = table.Column(type: "timestamptz", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Currencies", x => x.Id);
});
migrationBuilder.CreateTable(
name: "CurrencyChannelRelations",
columns: table => new
{
Id = table.Column(type: "bigint", nullable: false),
Title = table.Column(type: "text", nullable: false),
CurrencyId = table.Column(type: "integer", nullable: false),
PayChannelId = table.Column(type: "integer", nullable: false),
StartTime = table.Column(type: "integer", nullable: false),
EndTime = table.Column(type: "integer", nullable: false),
TimeZone = table.Column(type: "integer", nullable: false),
Rate = table.Column(type: "numeric", nullable: false),
Extended = table.Column(type: "text", nullable: false),
Status = table.Column(type: "integer", nullable: false),
CreateTime = table.Column(type: "timestamptz", nullable: false),
UpdateTime = table.Column(type: "timestamptz", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_CurrencyChannelRelations", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Languages",
columns: table => new
{
Id = table.Column(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column(type: "varchar(50)", nullable: false),
Title = table.Column(type: "varchar(50)", nullable: false),
Culture = table.Column(type: "varchar(25)", nullable: false),
FlagImage = table.Column(type: "varchar(256)", nullable: false),
DisplayOrder = table.Column(type: "integer", nullable: false),
Enabled = table.Column(type: "boolean", nullable: false),
ResourceVersion = table.Column(type: "varchar(256)", nullable: false),
CreateTime = table.Column(type: "timestamptz", nullable: false),
UpdateTime = table.Column(type: "timestamptz", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Languages", x => x.Id);
});
migrationBuilder.CreateTable(
name: "LocaleResources",
columns: table => new
{
Id = table.Column(type: "bigint", nullable: false),
LanguageId = table.Column(type: "integer", nullable: false),
Name = table.Column(type: "varchar(256)", nullable: false),
Value = table.Column(type: "varchar(1000)", nullable: false),
UpdateTime = table.Column(type: "timestamptz", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_LocaleResources", x => x.Id);
});
migrationBuilder.CreateTable(
name: "LocalizedProperties",
columns: table => new
{
Id = table.Column(type: "bigint", nullable: false),
LanguageNumber = table.Column(type: "integer", nullable: false),
Type = table.Column(type: "integer", nullable: false),
EntityId = table.Column(type: "bigint", nullable: false),
Key = table.Column(type: "varchar(256)", nullable: false),
Value = table.Column(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_LocalizedProperties", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Menus",
columns: table => new
{
Id = table.Column(type: "bigint", nullable: false),
Type = table.Column(type: "integer", nullable: false),
ParentId = table.Column(type: "bigint", nullable: false),
Name = table.Column(type: "varchar(50)", nullable: false),
Icon = table.Column(type: "varchar(256)", nullable: false),
Key = table.Column(type: "varchar(50)", nullable: false),
Url = table.Column(type: "varchar(256)", nullable: false),
Code = table.Column(type: "varchar(50)", nullable: false),
IsLink = table.Column(type: "boolean", nullable: false),
Enabled = table.Column(type: "boolean", nullable: false),
Depth = table.Column(type: "integer", nullable: false),
Path = table.Column(type: "varchar(100)", nullable: false),
DisplayOrder = table.Column(type: "integer", nullable: false),
CreateTime = table.Column(type: "timestamptz", nullable: false),
UpdateTime = table.Column(type: "timestamptz", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Menus", x => x.Id);
});
migrationBuilder.CreateTable(
name: "MessageTemplates",
columns: table => new
{
Id = table.Column(type: "bigint", nullable: false),
SiteId = table.Column(type: "bigint", nullable: false),
LanguageId = table.Column(type: "integer", nullable: false),
Type = table.Column(type: "integer", nullable: false),
Key = table.Column(type: "varchar(64)", nullable: false),
Name = table.Column(type: "varchar(256)", nullable: false),
Title = table.Column(type: "varchar(256)", nullable: false),
Body = table.Column(type: "text", nullable: false),
Attachments = table.Column(type: "varchar(1024)", nullable: false),
Enabled = table.Column(type: "boolean", nullable: false),
CreateTime = table.Column(type: "timestamptz", nullable: false),
UpdateTime = table.Column(type: "timestamptz", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_MessageTemplates", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Permissions",
columns: table => new
{
Id = table.Column(type: "bigint", nullable: false),
Name = table.Column(type: "varchar(128)", nullable: false),
Description = table.Column(type: "varchar(256)", nullable: false),
Category = table.Column(type: "varchar(128)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Permissions", x => x.Id);
});
migrationBuilder.CreateTable(
name: "ProductAttributeCombinations",
columns: table => new
{
Id = table.Column(type: "bigint", nullable: false),
ProductId = table.Column(type: "bigint", nullable: false),
CorporationId = table.Column(type: "bigint", nullable: false),
ManufacturerId = table.Column(type: "bigint", nullable: false),
AttributesJson = table.Column(type: "text", nullable: false),
StockQuantity = table.Column(type: "integer", nullable: false),
SalesQuantity = table.Column(type: "integer", nullable: false),
SkuNumber = table.Column(type: "varchar(20)", nullable: false),
Weight = table.Column(type: "numeric(18,4)", nullable: false),
WeightUnit = table.Column(type: "integer", nullable: false),
ProcessCharge = table.Column(type: "numeric(18,4)", nullable: false),
ProcessCost = table.Column(type: "numeric(18,4)", nullable: false),
Surcharge = table.Column(type: "numeric(18,4)", nullable: false),
SurchargeCost = table.Column(type: "numeric(18,4)", nullable: false),
MarketPrice = table.Column(type: "numeric(18,4)", nullable: false),
Price = table.Column(type: "numeric(18,4)", nullable: false),
Mark = table.Column(type: "integer", nullable: false),
Note = table.Column(type: "varchar(256)", nullable: false),
Enabled = table.Column(type: "boolean", nullable: false),
UpdateTime = table.Column(type: "timestamptz", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ProductAttributeCombinations", x => x.Id);
});
migrationBuilder.CreateTable(
name: "ProductAttributeOptions",
columns: table => new
{
Id = table.Column(type: "bigint", nullable: false),
AttributeId = table.Column(type: "bigint", nullable: false),
Value = table.Column(type: "varchar(50)", nullable: false),
Count = table.Column(type: "integer", nullable: false),
DisplayOrder = table.Column(type: "integer", nullable: false),
Standard = table.Column(type: "boolean", nullable: false),
Status = table.Column(type: "integer", nullable: false),
CreateTime = table.Column(type: "timestamptz", nullable: false),
UpdateTime = table.Column(type: "timestamptz", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ProductAttributeOptions", x => x.Id);
});
migrationBuilder.CreateTable(
name: "ProductAttributeRelations",
columns: table => new
{
Id = table.Column(type: "bigint", nullable: false),
ProductId = table.Column(type: "bigint", nullable: false),
AttributeId = table.Column(type: "bigint", nullable: false),
Image = table.Column(type: "boolean", nullable: false),
DisplayOrder = table.Column(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ProductAttributeRelations", x => x.Id);
});
migrationBuilder.CreateTable(
name: "ProductAttributes",
columns: table => new
{
Id = table.Column(type: "bigint", nullable: false),
CategoryId = table.Column(type: "bigint", nullable: false),
ParentId = table.Column(type: "bigint", nullable: false),
Name = table.Column(type: "varchar(50)", nullable: false),
WeightIsRequired = table.Column(type: "boolean", nullable: false),
WeightUnit = table.Column(type: "integer", nullable: false),
ControlType = table.Column(type: "integer", nullable: false),
Count = table.Column(type: "integer", nullable: false),
DisplayOrder = table.Column(type: "integer", nullable: false),
IsRequired = table.Column(type: "boolean", nullable: false),
Status = table.Column(type: "integer", nullable: false),
CreateTime = table.Column(type: "timestamptz", nullable: false),
UpdateTime = table.Column(type: "timestamptz", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ProductAttributes", x => x.Id);
});
migrationBuilder.CreateTable(
name: "ProductAttributeValues",
columns: table => new
{
Id = table.Column(type: "bigint", nullable: false),
ProductId = table.Column(type: "bigint", nullable: false),
OptionId = table.Column(type: "bigint", nullable: false),
ProductAttributeRelationId = table.Column(type: "bigint", nullable: false),
Name = table.Column(type: "varchar(50)", nullable: false),
Image = table.Column(type: "varchar(256)", nullable: false),
Weight = table.Column(type: "numeric(18,4)", nullable: false),
WeightUnit = table.Column(type: "integer", nullable: false),
IsAddWeight = table.Column(type: "boolean", nullable: false),
DisplayOrder = table.Column(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ProductAttributeValues", x => x.Id);
});
migrationBuilder.CreateTable(
name: "ProductInventories",
columns: table => new
{
Id = table.Column(type: "bigint", nullable: false),
CorporationId = table.Column(type: "bigint", nullable: false),
ProductId = table.Column(type: "bigint", nullable: false),
ProductAttributeCombinationId = table.Column(type: "bigint", nullable: false),
WarehouseId = table.Column(type: "bigint", nullable: false),
StockQuantity = table.Column(type: "integer", nullable: false),
CreateTime = table.Column(type: "timestamptz", nullable: false),
UpdateTime = table.Column(type: "timestamptz", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ProductInventories", x => x.Id);
});
migrationBuilder.CreateTable(
name: "ProductInventoryLogs",
columns: table => new
{
Id = table.Column(type: "bigint", nullable: false),
Operator = table.Column(type: "bigint", nullable: true),
Type = table.Column(type: "integer", nullable: true),
ProductId = table.Column(type: "bigint", nullable: false),
StoreId = table.Column(type: "bigint", nullable: false),
CorporationId = table.Column(type: "bigint", nullable: false),
ManufacturerId = table.Column(type: "bigint", nullable: false),
WarehouseId = table.Column(type: "bigint", nullable: false),
ProductAttributeCombinationId = table.Column(type: "bigint", nullable: false),
OrderId = table.Column(type: "bigint", nullable: false),
ChangeAmount = table.Column(type: "integer", nullable: false),
Weight = table.Column(type: "numeric(18,4)", nullable: false),
BeforeStock = table.Column(type: "integer", nullable: false),
AfterStock = table.Column(type: "integer", nullable: false),
Note = table.Column(type: "varchar(256)", nullable: false),
CreateTime = table.Column