forked from ddrilling/AsbCloudServer
Дмитрий Степанов
0a0f242da2
1. Расширил DbContext 2. Накатил миграции 3. Добавил новые значения для инициализации
48 lines
2.0 KiB
C#
48 lines
2.0 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|
|
|
#nullable disable
|
|
|
|
namespace AsbCloudDb.Migrations
|
|
{
|
|
public partial class Add_HelpPage : Migration
|
|
{
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "t_help_page",
|
|
columns: table => new
|
|
{
|
|
id = table.Column<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
url_page = table.Column<string>(type: "text", nullable: false, comment: "Url страницы"),
|
|
id_category = table.Column<int>(type: "integer", nullable: false, comment: "id категории файла"),
|
|
name = table.Column<string>(type: "text", nullable: false, comment: "Название файла"),
|
|
file_size = table.Column<long>(type: "bigint", nullable: false, comment: "Размер файла")
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_t_help_page", x => x.id);
|
|
table.ForeignKey(
|
|
name: "FK_t_help_page_t_file_category_id_category",
|
|
column: x => x.id_category,
|
|
principalTable: "t_file_category",
|
|
principalColumn: "id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
},
|
|
comment: "Справки");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_t_help_page_id_category",
|
|
table: "t_help_page",
|
|
column: "id_category");
|
|
}
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "t_help_page");
|
|
}
|
|
}
|
|
}
|