using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ApiTools.Database.Migrations.Migrations
{
///
public partial class Init : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Channel",
columns: table => new
{
Id = table.Column(type: "uniqueidentifier", nullable: false),
Code = table.Column(type: "nvarchar(max)", nullable: true),
Name = table.Column(type: "nvarchar(max)", nullable: true),
Sort = table.Column(type: "int", nullable: false),
TraceId = table.Column(type: "nvarchar(max)", nullable: true),
CreatedTime = table.Column(type: "datetimeoffset", nullable: false),
CreatedUserId = table.Column(type: "uniqueidentifier", nullable: true),
CreatedChannelId = table.Column(type: "uniqueidentifier", nullable: true),
UpdatedTime = table.Column(type: "datetimeoffset", nullable: true),
UpdatedUserId = table.Column(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Channel", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Resource",
columns: table => new
{
Id = table.Column(type: "uniqueidentifier", nullable: false),
ApplicationName = table.Column(type: "nvarchar(max)", nullable: true),
DynamicAssemblyName = table.Column(type: "nvarchar(max)", nullable: true),
ServiceName = table.Column(type: "nvarchar(max)", nullable: true),
ControllerName = table.Column(type: "nvarchar(max)", nullable: true),
ControllerSummary = table.Column(type: "nvarchar(max)", nullable: true),
ActionName = table.Column(type: "nvarchar(max)", nullable: true),
ActionSummary = table.Column(type: "nvarchar(max)", nullable: true),
Code = table.Column(type: "nvarchar(max)", nullable: false),
Name = table.Column(type: "nvarchar(max)", nullable: false),
AllowAnonymous = table.Column(type: "bit", nullable: false),
Method = table.Column(type: "int", nullable: false),
FileUpload = table.Column(type: "bit", nullable: false),
IsFromForm = table.Column(type: "bit", nullable: false),
CustomResponse = table.Column(type: "bit", nullable: false),
RouteArea = table.Column(type: "nvarchar(max)", nullable: true),
Route = table.Column(type: "nvarchar(max)", nullable: false),
RequestTypeName = table.Column(type: "nvarchar(max)", nullable: false),
RequestTypeFullName = table.Column(type: "nvarchar(max)", nullable: false),
ResponseTypeName = table.Column(type: "nvarchar(max)", nullable: true),
ResponseTypeFullName = table.Column(type: "nvarchar(max)", nullable: true),
IsExpired = table.Column(type: "bit", nullable: false),
Sort = table.Column(type: "int", nullable: false),
TraceId = table.Column(type: "nvarchar(max)", nullable: true),
CreatedTime = table.Column(type: "datetimeoffset", nullable: false),
CreatedUserId = table.Column(type: "uniqueidentifier", nullable: true),
CreatedChannelId = table.Column(type: "uniqueidentifier", nullable: true),
UpdatedTime = table.Column(type: "datetimeoffset", nullable: true),
UpdatedUserId = table.Column(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Resource", x => x.Id);
});
migrationBuilder.CreateTable(
name: "ScheduleJobDetail",
columns: table => new
{
Id = table.Column(type: "uniqueidentifier", nullable: false),
JobId = table.Column(type: "nvarchar(max)", nullable: true),
GroupName = table.Column(type: "nvarchar(max)", nullable: true),
JobType = table.Column(type: "nvarchar(max)", nullable: true),
AssemblyName = table.Column(type: "nvarchar(max)", nullable: true),
Description = table.Column(type: "nvarchar(max)", nullable: true),
Concurrent = table.Column(type: "bit", nullable: false),
IncludeAnnotations = table.Column(type: "bit", nullable: false),
Properties = table.Column(type: "nvarchar(max)", nullable: true),
Sort = table.Column(type: "int", nullable: false),
TraceId = table.Column(type: "nvarchar(max)", nullable: true),
CreatedTime = table.Column(type: "datetimeoffset", nullable: false),
CreatedUserId = table.Column(type: "uniqueidentifier", nullable: true),
CreatedChannelId = table.Column(type: "uniqueidentifier", nullable: true),
UpdatedTime = table.Column(type: "datetimeoffset", nullable: true),
UpdatedUserId = table.Column(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ScheduleJobDetail", x => x.Id);
});
migrationBuilder.CreateTable(
name: "ScheduleJobTrigger",
columns: table => new
{
Id = table.Column(type: "uniqueidentifier", nullable: false),
TriggerId = table.Column(type: "nvarchar(max)", nullable: true),
JobId = table.Column(type: "nvarchar(max)", nullable: true),
TriggerType = table.Column(type: "nvarchar(max)", nullable: true),
AssemblyName = table.Column(type: "nvarchar(max)", nullable: true),
Args = table.Column(type: "nvarchar(max)", nullable: true),
Description = table.Column(type: "nvarchar(max)", nullable: true),
Status = table.Column(type: "bigint", nullable: false),
StartTime = table.Column(type: "datetime2", nullable: true),
EndTime = table.Column(type: "datetime2", nullable: true),
LastRunTime = table.Column(type: "datetime2", nullable: true),
NextRunTime = table.Column(type: "datetime2", nullable: true),
NumberOfRuns = table.Column(type: "bigint", nullable: false),
MaxNumberOfRuns = table.Column(type: "bigint", nullable: false),
NumberOfErrors = table.Column(type: "bigint", nullable: false),
MaxNumberOfErrors = table.Column(type: "bigint", nullable: false),
NumRetries = table.Column(type: "bigint", nullable: false),
RetryTimeout = table.Column(type: "int", nullable: false),
StartNow = table.Column(type: "bit", nullable: false),
RunOnStart = table.Column(type: "bit", nullable: false),
ResetOnlyOnce = table.Column(type: "bit", nullable: false),
Result = table.Column(type: "nvarchar(max)", nullable: true),
ElapsedTime = table.Column(type: "bigint", nullable: false),
Sort = table.Column(type: "int", nullable: false),
TraceId = table.Column(type: "nvarchar(max)", nullable: true),
CreatedTime = table.Column(type: "datetimeoffset", nullable: false),
CreatedUserId = table.Column(type: "uniqueidentifier", nullable: true),
CreatedChannelId = table.Column(type: "uniqueidentifier", nullable: true),
UpdatedTime = table.Column(type: "datetimeoffset", nullable: true),
UpdatedUserId = table.Column(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ScheduleJobTrigger", x => x.Id);
});
migrationBuilder.CreateTable(
name: "SmsLog",
columns: table => new
{
Id = table.Column(type: "uniqueidentifier", nullable: false),
Access = table.Column(type: "int", nullable: false),
PhoneNumber = table.Column(type: "nvarchar(11)", maxLength: 11, nullable: false),
TemplateCode = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false),
TemplateParam = table.Column(type: "nvarchar(max)", nullable: true),
Expiry = table.Column(type: "datetime2", nullable: true),
IsUsed = table.Column(type: "bit", nullable: false),
Status = table.Column(type: "int", nullable: false),
RequestId = table.Column(type: "nvarchar(max)", nullable: true),
Code = table.Column(type: "nvarchar(max)", nullable: true),
Message = table.Column(type: "nvarchar(max)", nullable: true),
Sort = table.Column(type: "int", nullable: false),
TraceId = table.Column(type: "nvarchar(max)", nullable: true),
CreatedTime = table.Column(type: "datetimeoffset", nullable: false),
CreatedUserId = table.Column(type: "uniqueidentifier", nullable: true),
CreatedChannelId = table.Column(type: "uniqueidentifier", nullable: true),
UpdatedTime = table.Column(type: "datetimeoffset", nullable: true),
UpdatedUserId = table.Column(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_SmsLog", x => x.Id);
});
migrationBuilder.CreateTable(
name: "SmsSetting",
columns: table => new
{
Id = table.Column(type: "uniqueidentifier", nullable: false),
IsDisabled = table.Column(type: "bit", nullable: false),
WithoutParams = table.Column(type: "bit", nullable: false),
MinutelyMaxCount = table.Column(type: "int", nullable: false),
HourlyMaxCount = table.Column(type: "int", nullable: false),
DailyMaxCount = table.Column(type: "int", nullable: false),
Sort = table.Column(type: "int", nullable: false),
TraceId = table.Column(type: "nvarchar(max)", nullable: true),
CreatedTime = table.Column(type: "datetimeoffset", nullable: false),
CreatedUserId = table.Column(type: "uniqueidentifier", nullable: true),
CreatedChannelId = table.Column(type: "uniqueidentifier", nullable: true),
UpdatedTime = table.Column(type: "datetimeoffset", nullable: true),
UpdatedUserId = table.Column(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_SmsSetting", x => x.Id);
});
migrationBuilder.CreateTable(
name: "SmsSettingAccess",
columns: table => new
{
Id = table.Column(type: "uniqueidentifier", nullable: false),
SettingId = table.Column(type: "uniqueidentifier", nullable: false),
Access = table.Column(type: "int", nullable: false),
IsDisabled = table.Column(type: "bit", nullable: false),
Sort = table.Column(type: "int", nullable: false),
TraceId = table.Column(type: "nvarchar(max)", nullable: true),
CreatedTime = table.Column(type: "datetimeoffset", nullable: false),
CreatedUserId = table.Column(type: "uniqueidentifier", nullable: true),
CreatedChannelId = table.Column(type: "uniqueidentifier", nullable: true),
UpdatedTime = table.Column(type: "datetimeoffset", nullable: true),
UpdatedUserId = table.Column(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_SmsSettingAccess", x => x.Id);
table.ForeignKey(
name: "FK_SmsSettingAccess_SmsSetting_SettingId",
column: x => x.SettingId,
principalTable: "SmsSetting",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_SmsSettingAccess_SettingId",
table: "SmsSettingAccess",
column: "SettingId");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Channel");
migrationBuilder.DropTable(
name: "Resource");
migrationBuilder.DropTable(
name: "ScheduleJobDetail");
migrationBuilder.DropTable(
name: "ScheduleJobTrigger");
migrationBuilder.DropTable(
name: "SmsLog");
migrationBuilder.DropTable(
name: "SmsSettingAccess");
migrationBuilder.DropTable(
name: "SmsSetting");
}
}
}