using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Newtonsoft.Json.Linq;
#nullable disable
namespace JiShe.IoT.Migrations
{
///
public partial class InitialCreate : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "AbpAuditLogExcelFiles",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
TenantId = table.Column(type: "uuid", nullable: true),
FileName = table.Column(type: "character varying(256)", maxLength: 256, nullable: true),
CreationTime = table.Column(type: "timestamp with time zone", nullable: false),
CreatorId = table.Column(type: "uuid", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpAuditLogExcelFiles", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpAuditLogs",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
ApplicationName = table.Column(type: "character varying(96)", maxLength: 96, nullable: true),
UserId = table.Column(type: "uuid", nullable: true),
UserName = table.Column(type: "character varying(256)", maxLength: 256, nullable: true),
TenantId = table.Column(type: "uuid", nullable: true),
TenantName = table.Column(type: "character varying(64)", maxLength: 64, nullable: true),
ImpersonatorUserId = table.Column(type: "uuid", nullable: true),
ImpersonatorUserName = table.Column(type: "character varying(256)", maxLength: 256, nullable: true),
ImpersonatorTenantId = table.Column(type: "uuid", nullable: true),
ImpersonatorTenantName = table.Column(type: "character varying(64)", maxLength: 64, nullable: true),
ExecutionTime = table.Column(type: "timestamp with time zone", nullable: false),
ExecutionDuration = table.Column(type: "integer", nullable: false),
ClientIpAddress = table.Column(type: "character varying(64)", maxLength: 64, nullable: true),
ClientName = table.Column(type: "character varying(128)", maxLength: 128, nullable: true),
ClientId = table.Column(type: "character varying(64)", maxLength: 64, nullable: true),
CorrelationId = table.Column(type: "character varying(64)", maxLength: 64, nullable: true),
BrowserInfo = table.Column(type: "character varying(512)", maxLength: 512, nullable: true),
HttpMethod = table.Column(type: "character varying(16)", maxLength: 16, nullable: true),
Url = table.Column(type: "character varying(256)", maxLength: 256, nullable: true),
Exceptions = table.Column(type: "text", nullable: true),
Comments = table.Column(type: "character varying(256)", maxLength: 256, nullable: true),
HttpStatusCode = table.Column(type: "integer", nullable: true),
ExtraProperties = table.Column(type: "text", nullable: false),
ConcurrencyStamp = table.Column(type: "character varying(40)", maxLength: 40, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpAuditLogs", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpBackgroundJobs",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
ApplicationName = table.Column(type: "character varying(96)", maxLength: 96, nullable: true),
JobName = table.Column(type: "character varying(128)", maxLength: 128, nullable: false),
JobArgs = table.Column(type: "character varying(1048576)", maxLength: 1048576, nullable: false),
TryCount = table.Column(type: "smallint", nullable: false, defaultValue: (short)0),
CreationTime = table.Column(type: "timestamp with time zone", nullable: false),
NextTryTime = table.Column(type: "timestamp with time zone", nullable: false),
LastTryTime = table.Column(type: "timestamp with time zone", nullable: true),
IsAbandoned = table.Column(type: "boolean", nullable: false, defaultValue: false),
Priority = table.Column(type: "smallint", nullable: false, defaultValue: (byte)15),
ExtraProperties = table.Column(type: "text", nullable: false),
ConcurrencyStamp = table.Column(type: "character varying(40)", maxLength: 40, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpBackgroundJobs", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpClaimTypes",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
Name = table.Column(type: "character varying(256)", maxLength: 256, nullable: false),
Required = table.Column(type: "boolean", nullable: false),
IsStatic = table.Column(type: "boolean", nullable: false),
Regex = table.Column(type: "character varying(512)", maxLength: 512, nullable: true),
RegexDescription = table.Column(type: "character varying(128)", maxLength: 128, nullable: true),
Description = table.Column(type: "character varying(256)", maxLength: 256, nullable: true),
ValueType = table.Column(type: "integer", nullable: false),
CreationTime = table.Column(type: "timestamp with time zone", nullable: false),
ExtraProperties = table.Column(type: "text", nullable: false),
ConcurrencyStamp = table.Column(type: "character varying(40)", maxLength: 40, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpClaimTypes", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpDataDictionaries",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
TenantId = table.Column(type: "uuid", nullable: true),
Code = table.Column(type: "character varying(256)", maxLength: 256, nullable: false),
DisplayText = table.Column(type: "character varying(256)", maxLength: 256, nullable: false),
Description = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: false),
ExtraProperties = table.Column(type: "text", nullable: false),
ConcurrencyStamp = table.Column(type: "character varying(40)", maxLength: 40, nullable: false),
CreationTime = table.Column(type: "timestamp with time zone", nullable: false),
CreatorId = table.Column(type: "uuid", nullable: true),
LastModificationTime = table.Column(type: "timestamp with time zone", nullable: true),
LastModifierId = table.Column(type: "uuid", nullable: true),
IsDeleted = table.Column(type: "boolean", nullable: false, defaultValue: false),
DeleterId = table.Column(type: "uuid", nullable: true),
DeletionTime = table.Column(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpDataDictionaries", x => x.Id);
},
comment: "数据字典");
migrationBuilder.CreateTable(
name: "AbpFeatureGroups",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
Name = table.Column(type: "character varying(128)", maxLength: 128, nullable: false),
DisplayName = table.Column(type: "character varying(256)", maxLength: 256, nullable: false),
ExtraProperties = table.Column(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpFeatureGroups", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpFeatures",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
GroupName = table.Column(type: "character varying(128)", maxLength: 128, nullable: false),
Name = table.Column(type: "character varying(128)", maxLength: 128, nullable: false),
ParentName = table.Column(type: "character varying(128)", maxLength: 128, nullable: true),
DisplayName = table.Column(type: "character varying(256)", maxLength: 256, nullable: false),
Description = table.Column(type: "character varying(256)", maxLength: 256, nullable: true),
DefaultValue = table.Column(type: "character varying(256)", maxLength: 256, nullable: true),
IsVisibleToClients = table.Column(type: "boolean", nullable: false),
IsAvailableToHost = table.Column(type: "boolean", nullable: false),
AllowedProviders = table.Column(type: "character varying(256)", maxLength: 256, nullable: true),
ValueType = table.Column(type: "character varying(2048)", maxLength: 2048, nullable: true),
ExtraProperties = table.Column(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpFeatures", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpFeatureValues",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
Name = table.Column(type: "character varying(128)", maxLength: 128, nullable: false),
Value = table.Column(type: "character varying(128)", maxLength: 128, nullable: false),
ProviderName = table.Column(type: "character varying(64)", maxLength: 64, nullable: true),
ProviderKey = table.Column(type: "character varying(64)", maxLength: 64, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpFeatureValues", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpFileObjects",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
TenantId = table.Column(type: "uuid", nullable: true),
FileName = table.Column(type: "character varying(128)", maxLength: 128, nullable: false, comment: "文件名称"),
FileSize = table.Column(type: "bigint", nullable: false, comment: "文件大小"),
ContentType = table.Column(type: "character varying(128)", maxLength: 128, nullable: false, comment: "文件名称"),
Md5Hash = table.Column(type: "character varying(50)", maxLength: 50, nullable: false, comment: "文件MD5"),
ExtraProperties = table.Column(type: "text", nullable: false),
ConcurrencyStamp = table.Column(type: "character varying(40)", maxLength: 40, nullable: false),
CreationTime = table.Column(type: "timestamp with time zone", nullable: false),
CreatorId = table.Column(type: "uuid", nullable: true),
LastModificationTime = table.Column(type: "timestamp with time zone", nullable: true),
LastModifierId = table.Column(type: "uuid", nullable: true),
IsDeleted = table.Column(type: "boolean", nullable: false, defaultValue: false),
DeleterId = table.Column(type: "uuid", nullable: true),
DeletionTime = table.Column(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpFileObjects", x => x.Id);
},
comment: "文件管理");
migrationBuilder.CreateTable(
name: "AbpLanguages",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
TenantId = table.Column(type: "uuid", nullable: true),
CultureName = table.Column(type: "character varying(128)", maxLength: 128, nullable: false, comment: "语言名称"),
UiCultureName = table.Column(type: "character varying(128)", maxLength: 128, nullable: false, comment: "Ui语言名称"),
DisplayName = table.Column(type: "character varying(128)", maxLength: 128, nullable: false, comment: "显示名称"),
FlagIcon = table.Column(type: "character varying(128)", maxLength: 128, nullable: true, comment: "图标"),
IsEnabled = table.Column(type: "boolean", nullable: false),
IsDefault = table.Column(type: "boolean", nullable: false),
ExtraProperties = table.Column(type: "text", nullable: false),
ConcurrencyStamp = table.Column(type: "character varying(40)", maxLength: 40, nullable: false),
CreationTime = table.Column(type: "timestamp with time zone", nullable: false),
CreatorId = table.Column(type: "uuid", nullable: true),
LastModificationTime = table.Column(type: "timestamp with time zone", nullable: true),
LastModifierId = table.Column(type: "uuid", nullable: true),
IsDeleted = table.Column(type: "boolean", nullable: false, defaultValue: false),
DeleterId = table.Column(type: "uuid", nullable: true),
DeletionTime = table.Column(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpLanguages", x => x.Id);
},
comment: "语言管理");
migrationBuilder.CreateTable(
name: "AbpLanguageTexts",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
TenantId = table.Column(type: "uuid", nullable: true),
CultureName = table.Column(type: "character varying(128)", maxLength: 128, nullable: false, comment: "语言名称"),
ResourceName = table.Column(type: "character varying(128)", maxLength: 128, nullable: false, comment: "资源名称"),
Name = table.Column(type: "character varying(256)", maxLength: 256, nullable: false, comment: "名称"),
Value = table.Column(type: "character varying(256)", maxLength: 256, nullable: false, comment: "值"),
ExtraProperties = table.Column(type: "text", nullable: false),
ConcurrencyStamp = table.Column(type: "character varying(40)", maxLength: 40, nullable: false),
CreationTime = table.Column(type: "timestamp with time zone", nullable: false),
CreatorId = table.Column(type: "uuid", nullable: true),
LastModificationTime = table.Column(type: "timestamp with time zone", nullable: true),
LastModifierId = table.Column(type: "uuid", nullable: true),
IsDeleted = table.Column(type: "boolean", nullable: false, defaultValue: false),
DeleterId = table.Column(type: "uuid", nullable: true),
DeletionTime = table.Column(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpLanguageTexts", x => x.Id);
},
comment: "语言文本管理");
migrationBuilder.CreateTable(
name: "AbpLinkUsers",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
SourceUserId = table.Column(type: "uuid", nullable: false),
SourceTenantId = table.Column(type: "uuid", nullable: true),
TargetUserId = table.Column(type: "uuid", nullable: false),
TargetTenantId = table.Column(type: "uuid", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpLinkUsers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpNotifications",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
TenantId = table.Column(type: "uuid", nullable: true),
Title = table.Column(type: "character varying(128)", maxLength: 128, nullable: false),
Content = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: false),
MessageType = table.Column(type: "integer", nullable: false),
MessageLevel = table.Column(type: "integer", nullable: false),
SenderUserId = table.Column(type: "uuid", nullable: false),
SenderUserName = table.Column(type: "character varying(128)", maxLength: 128, nullable: false),
ReceiveUserId = table.Column(type: "uuid", nullable: true),
ReceiveUserName = table.Column(type: "character varying(128)", maxLength: 128, nullable: true),
Read = table.Column(type: "boolean", nullable: false),
ReadTime = table.Column(type: "timestamp with time zone", nullable: true),
ExtraProperties = table.Column(type: "text", nullable: false),
ConcurrencyStamp = table.Column(type: "character varying(40)", maxLength: 40, nullable: false),
CreationTime = table.Column(type: "timestamp with time zone", nullable: false),
CreatorId = table.Column(type: "uuid", nullable: true),
LastModificationTime = table.Column(type: "timestamp with time zone", nullable: true),
LastModifierId = table.Column(type: "uuid", nullable: true),
IsDeleted = table.Column(type: "boolean", nullable: false, defaultValue: false),
DeleterId = table.Column(type: "uuid", nullable: true),
DeletionTime = table.Column(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpNotifications", x => x.Id);
},
comment: "消息通知管理");
migrationBuilder.CreateTable(
name: "AbpNotificationSubscriptions",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
TenantId = table.Column(type: "uuid", nullable: true),
NotificationId = table.Column(type: "uuid", nullable: false),
ReceiveUserId = table.Column(type: "uuid", nullable: false),
ReceiveUserName = table.Column(type: "character varying(128)", maxLength: 128, nullable: true),
Read = table.Column(type: "boolean", nullable: false),
ReadTime = table.Column(type: "timestamp with time zone", nullable: false),
ExtraProperties = table.Column(type: "text", nullable: false),
ConcurrencyStamp = table.Column(type: "character varying(40)", maxLength: 40, nullable: false),
CreationTime = table.Column(type: "timestamp with time zone", nullable: false),
CreatorId = table.Column(type: "uuid", nullable: true),
LastModificationTime = table.Column(type: "timestamp with time zone", nullable: true),
LastModifierId = table.Column(type: "uuid", nullable: true),
IsDeleted = table.Column(type: "boolean", nullable: false, defaultValue: false),
DeleterId = table.Column(type: "uuid", nullable: true),
DeletionTime = table.Column(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpNotificationSubscriptions", x => x.Id);
},
comment: "消息订阅者");
migrationBuilder.CreateTable(
name: "AbpOrganizationUnits",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
TenantId = table.Column(type: "uuid", nullable: true),
ParentId = table.Column(type: "uuid", nullable: true),
Code = table.Column(type: "character varying(95)", maxLength: 95, nullable: false),
DisplayName = table.Column(type: "character varying(128)", maxLength: 128, nullable: false),
EntityVersion = table.Column(type: "integer", nullable: false),
ExtraProperties = table.Column(type: "text", nullable: false),
ConcurrencyStamp = table.Column(type: "character varying(40)", maxLength: 40, nullable: false),
CreationTime = table.Column(type: "timestamp with time zone", nullable: false),
CreatorId = table.Column(type: "uuid", nullable: true),
LastModificationTime = table.Column(type: "timestamp with time zone", nullable: true),
LastModifierId = table.Column(type: "uuid", nullable: true),
IsDeleted = table.Column(type: "boolean", nullable: false, defaultValue: false),
DeleterId = table.Column(type: "uuid", nullable: true),
DeletionTime = table.Column(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpOrganizationUnits", x => x.Id);
table.ForeignKey(
name: "FK_AbpOrganizationUnits_AbpOrganizationUnits_ParentId",
column: x => x.ParentId,
principalTable: "AbpOrganizationUnits",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "AbpPermissionGrants",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
TenantId = table.Column(type: "uuid", nullable: true),
Name = table.Column(type: "character varying(128)", maxLength: 128, nullable: false),
ProviderName = table.Column(type: "character varying(64)", maxLength: 64, nullable: false),
ProviderKey = table.Column(type: "character varying(64)", maxLength: 64, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpPermissionGrants", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpPermissionGroups",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
Name = table.Column(type: "character varying(128)", maxLength: 128, nullable: false),
DisplayName = table.Column(type: "character varying(256)", maxLength: 256, nullable: false),
ExtraProperties = table.Column(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpPermissionGroups", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpPermissions",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
GroupName = table.Column(type: "character varying(128)", maxLength: 128, nullable: true),
Name = table.Column(type: "character varying(128)", maxLength: 128, nullable: false),
ResourceName = table.Column(type: "character varying(256)", maxLength: 256, nullable: true),
ManagementPermissionName = table.Column(type: "character varying(128)", maxLength: 128, nullable: true),
ParentName = table.Column(type: "character varying(128)", maxLength: 128, nullable: true),
DisplayName = table.Column(type: "character varying(256)", maxLength: 256, nullable: false),
IsEnabled = table.Column(type: "boolean", nullable: false),
MultiTenancySide = table.Column(type: "smallint", nullable: false),
Providers = table.Column(type: "character varying(128)", maxLength: 128, nullable: true),
StateCheckers = table.Column(type: "character varying(256)", maxLength: 256, nullable: true),
ExtraProperties = table.Column(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpPermissions", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpResourcePermissionGrants",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
TenantId = table.Column(type: "uuid", nullable: true),
Name = table.Column(type: "character varying(128)", maxLength: 128, nullable: false),
ProviderName = table.Column(type: "character varying(64)", maxLength: 64, nullable: false),
ProviderKey = table.Column(type: "character varying(64)", maxLength: 64, nullable: false),
ResourceName = table.Column(type: "character varying(256)", maxLength: 256, nullable: false),
ResourceKey = table.Column(type: "character varying(256)", maxLength: 256, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpResourcePermissionGrants", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpRoles",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
TenantId = table.Column(type: "uuid", nullable: true),
Name = table.Column(type: "character varying(256)", maxLength: 256, nullable: false),
NormalizedName = table.Column(type: "character varying(256)", maxLength: 256, nullable: false),
IsDefault = table.Column(type: "boolean", nullable: false),
IsStatic = table.Column(type: "boolean", nullable: false),
IsPublic = table.Column(type: "boolean", nullable: false),
EntityVersion = table.Column(type: "integer", nullable: false),
CreationTime = table.Column(type: "timestamp with time zone", nullable: false),
ExtraProperties = table.Column(type: "text", nullable: false),
ConcurrencyStamp = table.Column(type: "character varying(40)", maxLength: 40, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpRoles", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpSecurityLogs",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
TenantId = table.Column(type: "uuid", nullable: true),
ApplicationName = table.Column(type: "character varying(96)", maxLength: 96, nullable: true),
Identity = table.Column(type: "character varying(96)", maxLength: 96, nullable: true),
Action = table.Column(type: "character varying(96)", maxLength: 96, nullable: true),
UserId = table.Column(type: "uuid", nullable: true),
UserName = table.Column(type: "character varying(256)", maxLength: 256, nullable: true),
TenantName = table.Column(type: "character varying(64)", maxLength: 64, nullable: true),
ClientId = table.Column(type: "character varying(64)", maxLength: 64, nullable: true),
CorrelationId = table.Column(type: "character varying(64)", maxLength: 64, nullable: true),
ClientIpAddress = table.Column(type: "character varying(64)", maxLength: 64, nullable: true),
BrowserInfo = table.Column(type: "character varying(512)", maxLength: 512, nullable: true),
CreationTime = table.Column(type: "timestamp with time zone", nullable: false),
ExtraProperties = table.Column(type: "text", nullable: false),
ConcurrencyStamp = table.Column(type: "character varying(40)", maxLength: 40, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpSecurityLogs", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpSessions",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
SessionId = table.Column(type: "character varying(128)", maxLength: 128, nullable: false),
Device = table.Column(type: "character varying(64)", maxLength: 64, nullable: false),
DeviceInfo = table.Column(type: "character varying(256)", maxLength: 256, nullable: true),
TenantId = table.Column(type: "uuid", nullable: true),
UserId = table.Column(type: "uuid", nullable: false),
ClientId = table.Column(type: "character varying(64)", maxLength: 64, nullable: true),
IpAddresses = table.Column(type: "character varying(2048)", maxLength: 2048, nullable: true),
SignedIn = table.Column(type: "timestamp with time zone", nullable: false),
LastAccessed = table.Column