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, comment: "排序"), TraceId = table.Column(type: "nvarchar(max)", nullable: true, comment: "跟踪Id"), CreatedUserInfoId = table.Column(type: "uniqueidentifier", nullable: true, comment: "创建操作人"), UpdateUserInfoId = table.Column(type: "uniqueidentifier", nullable: true, comment: "最后更新操作人"), IsDeleted = table.Column(type: "bit", nullable: false, comment: "是否删除") }, 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, comment: "排序"), TraceId = table.Column(type: "nvarchar(max)", nullable: true, comment: "跟踪Id"), CreatedUserInfoId = table.Column(type: "uniqueidentifier", nullable: true, comment: "创建操作人"), UpdateUserInfoId = table.Column(type: "uniqueidentifier", nullable: true, comment: "最后更新操作人"), IsDeleted = table.Column(type: "bit", nullable: false, comment: "是否删除") }, 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, comment: "排序"), TraceId = table.Column(type: "nvarchar(max)", nullable: true, comment: "跟踪Id"), CreatedUserInfoId = table.Column(type: "uniqueidentifier", nullable: true, comment: "创建操作人"), UpdateUserInfoId = table.Column(type: "uniqueidentifier", nullable: true, comment: "最后更新操作人"), IsDeleted = table.Column(type: "bit", nullable: false, comment: "是否删除") }, 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, comment: "排序"), TraceId = table.Column(type: "nvarchar(max)", nullable: true, comment: "跟踪Id"), CreatedUserInfoId = table.Column(type: "uniqueidentifier", nullable: true, comment: "创建操作人"), UpdateUserInfoId = table.Column(type: "uniqueidentifier", nullable: true, comment: "最后更新操作人"), IsDeleted = table.Column(type: "bit", nullable: false, comment: "是否删除") }, constraints: table => { table.PrimaryKey("PK_QueueLog", x => x.Id); }, comment: "消息队列日志"); migrationBuilder.CreateTable( name: "ResourceLog", columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), Url = table.Column(type: "nvarchar(max)", nullable: false), Method = table.Column(type: "nvarchar(6)", maxLength: 6, nullable: false), Headers = table.Column(type: "nvarchar(max)", nullable: true), Request = table.Column(type: "nvarchar(max)", nullable: true), Callback = table.Column(type: "nvarchar(max)", nullable: true), IsSuccess = table.Column(type: "bit", nullable: false), ClientIpAddress = table.Column(type: "nvarchar(max)", nullable: true), ElapsedMilliseconds = table.Column(type: "bigint", nullable: false), CreatedTime = table.Column(type: "datetimeoffset", nullable: false), UpdatedTime = table.Column(type: "datetimeoffset", nullable: true), Sort = table.Column(type: "int", nullable: false, comment: "排序"), TraceId = table.Column(type: "nvarchar(max)", nullable: true, comment: "跟踪Id"), CreatedUserInfoId = table.Column(type: "uniqueidentifier", nullable: true, comment: "创建操作人"), UpdateUserInfoId = table.Column(type: "uniqueidentifier", nullable: true, comment: "最后更新操作人"), IsDeleted = table.Column(type: "bit", nullable: false, comment: "是否删除") }, constraints: table => { table.PrimaryKey("PK_ResourceLog", x => x.Id); }); 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, comment: "排序"), TraceId = table.Column(type: "nvarchar(max)", nullable: true, comment: "跟踪Id"), CreatedUserInfoId = table.Column(type: "uniqueidentifier", nullable: true, comment: "创建操作人"), UpdateUserInfoId = table.Column(type: "uniqueidentifier", nullable: true, comment: "最后更新操作人"), IsDeleted = table.Column(type: "bit", nullable: false, comment: "是否删除") }, constraints: table => { table.PrimaryKey("PK_SmsLog", 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: "ResourceLog"); migrationBuilder.DropTable( name: "SmsLog"); } } }