using System;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
#nullable disable
|
|
namespace FlexJobApi.Database.Migrations.Migrations.LogDb
|
{
|
/// <inheritdoc />
|
public partial class Init : Migration
|
{
|
/// <inheritdoc />
|
protected override void Up(MigrationBuilder migrationBuilder)
|
{
|
migrationBuilder.CreateTable(
|
name: "ConsoleLog",
|
columns: table => new
|
{
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
Access = table.Column<int>(type: "int", nullable: false, comment: "通道"),
|
Level = table.Column<int>(type: "int", nullable: false, comment: "级别"),
|
Content = table.Column<string>(type: "nvarchar(max)", nullable: false, comment: "内容"),
|
StackTrace = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "堆栈跟踪"),
|
Url = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "链接地址"),
|
ClientIpAddress = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: true, comment: "客户IP地址"),
|
CreatedTime = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false),
|
UpdatedTime = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true),
|
Sort = table.Column<int>(type: "int", nullable: false),
|
TraceId = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
CreatedUserInfoId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
UpdateUserInfoId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
IsDeleted = table.Column<bool>(type: "bit", nullable: false)
|
},
|
constraints: table =>
|
{
|
table.PrimaryKey("PK_ConsoleLog", x => x.Id);
|
},
|
comment: "控制台日志");
|
|
migrationBuilder.CreateTable(
|
name: "DbAuditLog",
|
columns: table => new
|
{
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
TableName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false, comment: "表名"),
|
PrimaryKey = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "主键"),
|
Operate = table.Column<int>(type: "int", nullable: false, comment: "操作"),
|
OldValues = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "旧值"),
|
NewValues = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "新值"),
|
CreatedTime = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false),
|
UpdatedTime = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true),
|
Sort = table.Column<int>(type: "int", nullable: false),
|
TraceId = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
CreatedUserInfoId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
UpdateUserInfoId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
IsDeleted = table.Column<bool>(type: "bit", nullable: false)
|
},
|
constraints: table =>
|
{
|
table.PrimaryKey("PK_DbAuditLog", x => x.Id);
|
},
|
comment: "数据库审计日志");
|
|
migrationBuilder.CreateTable(
|
name: "ExceptionLog",
|
columns: table => new
|
{
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
Type = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true, comment: "类型"),
|
Code = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: true, comment: "代码"),
|
Message = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "消息"),
|
StackTrace = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "堆栈跟踪"),
|
CreatedTime = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false),
|
UpdatedTime = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true),
|
Sort = table.Column<int>(type: "int", nullable: false),
|
TraceId = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
CreatedUserInfoId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
UpdateUserInfoId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
IsDeleted = table.Column<bool>(type: "bit", nullable: false)
|
},
|
constraints: table =>
|
{
|
table.PrimaryKey("PK_ExceptionLog", x => x.Id);
|
},
|
comment: "异常日志");
|
|
migrationBuilder.CreateTable(
|
name: "QueueLog",
|
columns: table => new
|
{
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
Access = table.Column<int>(type: "int", nullable: false, comment: "通道"),
|
EventId = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false, comment: "事件Id"),
|
Data = table.Column<string>(type: "nvarchar(max)", nullable: false, comment: "数据"),
|
IsConsumOnce = table.Column<bool>(type: "bit", nullable: false, comment: "消息是否只消费一次"),
|
ElapsedMilliseconds = table.Column<long>(type: "bigint", nullable: false, comment: "耗时毫秒数"),
|
CreatedTime = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false),
|
UpdatedTime = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true),
|
Sort = table.Column<int>(type: "int", nullable: false),
|
TraceId = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
CreatedUserInfoId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
UpdateUserInfoId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
IsDeleted = table.Column<bool>(type: "bit", nullable: false)
|
},
|
constraints: table =>
|
{
|
table.PrimaryKey("PK_QueueLog", x => x.Id);
|
},
|
comment: "消息队列日志");
|
|
migrationBuilder.CreateTable(
|
name: "SmsLog",
|
columns: table => new
|
{
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
Access = table.Column<int>(type: "int", nullable: false, comment: "通道"),
|
PhoneNumber = table.Column<string>(type: "nvarchar(11)", maxLength: 11, nullable: false, comment: "手机号码"),
|
TemplateCode = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false, comment: "模板代码"),
|
TemplateParam = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "模板参数"),
|
Expiry = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "有效期"),
|
IsUsed = table.Column<bool>(type: "bit", nullable: false, comment: "是否使用"),
|
CreatedTime = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false),
|
UpdatedTime = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true),
|
Sort = table.Column<int>(type: "int", nullable: false),
|
TraceId = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
CreatedUserInfoId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
UpdateUserInfoId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
IsDeleted = table.Column<bool>(type: "bit", nullable: false)
|
},
|
constraints: table =>
|
{
|
table.PrimaryKey("PK_SmsLog", x => x.Id);
|
},
|
comment: "短信日志");
|
|
migrationBuilder.CreateTable(
|
name: "WebApiLog",
|
columns: table => new
|
{
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
Url = table.Column<string>(type: "nvarchar(max)", nullable: false, comment: "链接地址"),
|
Method = table.Column<string>(type: "nvarchar(6)", maxLength: 6, nullable: false, comment: "请求方式"),
|
Headers = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "请求头"),
|
Request = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "请求参数"),
|
Callback = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "回调数据"),
|
IsSuccess = table.Column<bool>(type: "bit", nullable: false, comment: "是否成功"),
|
ClientIpAddress = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "客户端IP地址"),
|
ElapsedMilliseconds = table.Column<long>(type: "bigint", nullable: false, comment: "耗时毫秒数"),
|
CreatedTime = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false),
|
UpdatedTime = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true),
|
Sort = table.Column<int>(type: "int", nullable: false),
|
TraceId = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
CreatedUserInfoId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
UpdateUserInfoId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
IsDeleted = table.Column<bool>(type: "bit", nullable: false)
|
},
|
constraints: table =>
|
{
|
table.PrimaryKey("PK_WebApiLog", x => x.Id);
|
},
|
comment: "接口日志");
|
}
|
|
/// <inheritdoc />
|
protected override void Down(MigrationBuilder migrationBuilder)
|
{
|
migrationBuilder.DropTable(
|
name: "ConsoleLog");
|
|
migrationBuilder.DropTable(
|
name: "DbAuditLog");
|
|
migrationBuilder.DropTable(
|
name: "ExceptionLog");
|
|
migrationBuilder.DropTable(
|
name: "QueueLog");
|
|
migrationBuilder.DropTable(
|
name: "SmsLog");
|
|
migrationBuilder.DropTable(
|
name: "WebApiLog");
|
}
|
}
|
}
|