using System;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
#nullable disable
|
|
namespace ApiTools.Database.Migrations.Migrations
|
{
|
/// <inheritdoc />
|
public partial class CreateUser : Migration
|
{
|
/// <inheritdoc />
|
protected override void Up(MigrationBuilder migrationBuilder)
|
{
|
migrationBuilder.AddColumn<Guid>(
|
name: "ChannelId",
|
table: "SmsSettingAccess",
|
type: "uniqueidentifier",
|
nullable: true);
|
|
migrationBuilder.AddColumn<Guid>(
|
name: "ChannelId",
|
table: "SmsSetting",
|
type: "uniqueidentifier",
|
nullable: true);
|
|
migrationBuilder.AddColumn<Guid>(
|
name: "ChannelId",
|
table: "SmsLog",
|
type: "uniqueidentifier",
|
nullable: true);
|
|
migrationBuilder.AddColumn<bool>(
|
name: "IsDisabled",
|
table: "Channel",
|
type: "bit",
|
nullable: false,
|
defaultValue: false);
|
|
migrationBuilder.CreateTable(
|
name: "User",
|
columns: table => new
|
{
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
Type = table.Column<int>(type: "int", nullable: false),
|
ChannelId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
Avatar = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
Name = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: true),
|
UserName = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: false),
|
PhoneNumber = table.Column<string>(type: "nvarchar(11)", maxLength: 11, nullable: true),
|
IsCheckPhoneNumber = table.Column<bool>(type: "bit", nullable: false),
|
Password = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
Level = table.Column<int>(type: "int", nullable: false),
|
Remark = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
Status = table.Column<int>(type: "int", nullable: false),
|
Sort = table.Column<int>(type: "int", nullable: false),
|
TraceId = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
CreatedTime = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false),
|
CreatedUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
CreatedChannelId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
UpdatedTime = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true),
|
UpdatedUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
IsDeleted = table.Column<bool>(type: "bit", nullable: false)
|
},
|
constraints: table =>
|
{
|
table.PrimaryKey("PK_User", x => x.Id);
|
table.ForeignKey(
|
name: "FK_User_Channel_ChannelId",
|
column: x => x.ChannelId,
|
principalTable: "Channel",
|
principalColumn: "Id");
|
});
|
|
migrationBuilder.InsertData(
|
table: "User",
|
columns: new[] { "Id", "Avatar", "ChannelId", "CreatedChannelId", "CreatedTime", "CreatedUserId", "IsCheckPhoneNumber", "IsDeleted", "Level", "Name", "Password", "PhoneNumber", "Remark", "Sort", "Status", "TraceId", "Type", "UpdatedTime", "UpdatedUserId", "UserName" },
|
values: new object[] { new Guid("11111111-1111-1111-1111-111111111111"), null, null, null, new DateTimeOffset(new DateTime(2000, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 8, 0, 0, 0)), null, false, false, 999, "管理员", "iEYggKrMhQ3ASUGLobra1w==:fn/DsMJUbD9FGpvBvR3moMpMPptdxzZlourPVhU479I=", null, null, 0, 10, null, 100, null, null, "system" });
|
|
migrationBuilder.CreateIndex(
|
name: "IX_SmsSettingAccess_ChannelId",
|
table: "SmsSettingAccess",
|
column: "ChannelId");
|
|
migrationBuilder.CreateIndex(
|
name: "IX_SmsSetting_ChannelId",
|
table: "SmsSetting",
|
column: "ChannelId");
|
|
migrationBuilder.CreateIndex(
|
name: "IX_SmsLog_ChannelId",
|
table: "SmsLog",
|
column: "ChannelId");
|
|
migrationBuilder.CreateIndex(
|
name: "IX_User_ChannelId",
|
table: "User",
|
column: "ChannelId");
|
|
migrationBuilder.AddForeignKey(
|
name: "FK_SmsLog_Channel_ChannelId",
|
table: "SmsLog",
|
column: "ChannelId",
|
principalTable: "Channel",
|
principalColumn: "Id");
|
|
migrationBuilder.AddForeignKey(
|
name: "FK_SmsSetting_Channel_ChannelId",
|
table: "SmsSetting",
|
column: "ChannelId",
|
principalTable: "Channel",
|
principalColumn: "Id");
|
|
migrationBuilder.AddForeignKey(
|
name: "FK_SmsSettingAccess_Channel_ChannelId",
|
table: "SmsSettingAccess",
|
column: "ChannelId",
|
principalTable: "Channel",
|
principalColumn: "Id");
|
}
|
|
/// <inheritdoc />
|
protected override void Down(MigrationBuilder migrationBuilder)
|
{
|
migrationBuilder.DropForeignKey(
|
name: "FK_SmsLog_Channel_ChannelId",
|
table: "SmsLog");
|
|
migrationBuilder.DropForeignKey(
|
name: "FK_SmsSetting_Channel_ChannelId",
|
table: "SmsSetting");
|
|
migrationBuilder.DropForeignKey(
|
name: "FK_SmsSettingAccess_Channel_ChannelId",
|
table: "SmsSettingAccess");
|
|
migrationBuilder.DropTable(
|
name: "User");
|
|
migrationBuilder.DropIndex(
|
name: "IX_SmsSettingAccess_ChannelId",
|
table: "SmsSettingAccess");
|
|
migrationBuilder.DropIndex(
|
name: "IX_SmsSetting_ChannelId",
|
table: "SmsSetting");
|
|
migrationBuilder.DropIndex(
|
name: "IX_SmsLog_ChannelId",
|
table: "SmsLog");
|
|
migrationBuilder.DropColumn(
|
name: "ChannelId",
|
table: "SmsSettingAccess");
|
|
migrationBuilder.DropColumn(
|
name: "ChannelId",
|
table: "SmsSetting");
|
|
migrationBuilder.DropColumn(
|
name: "ChannelId",
|
table: "SmsLog");
|
|
migrationBuilder.DropColumn(
|
name: "IsDisabled",
|
table: "Channel");
|
}
|
}
|
}
|