46 lines
1.7 KiB
C#
46 lines
1.7 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
namespace RMuseum.Migrations
|
|
{
|
|
public partial class Options : Migration
|
|
{
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "Options",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
Name = table.Column<string>(type: "nvarchar(450)", nullable: true),
|
|
Value = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
RAppUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Options", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_Options_AspNetUsers_RAppUserId",
|
|
column: x => x.RAppUserId,
|
|
principalTable: "AspNetUsers",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Options_RAppUserId_Name",
|
|
table: "Options",
|
|
columns: new[] { "RAppUserId", "Name" },
|
|
unique: true,
|
|
filter: "[RAppUserId] IS NOT NULL AND [Name] IS NOT NULL");
|
|
}
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "Options");
|
|
}
|
|
}
|
|
}
|