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