SPMS_API/SPMS.Infrastructure/Migrations/20260303023033_AddExternalDeviceId.cs

42 lines
1.2 KiB
C#

using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace SPMS.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddExternalDeviceId : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "ExternalDeviceId",
table: "Device",
type: "varchar(36)",
maxLength: 36,
nullable: false,
defaultValue: "")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_Device_ServiceId_ExternalDeviceId",
table: "Device",
columns: new[] { "ServiceId", "ExternalDeviceId" },
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_Device_ServiceId_ExternalDeviceId",
table: "Device");
migrationBuilder.DropColumn(
name: "ExternalDeviceId",
table: "Device");
}
}
}