69 lines
2.4 KiB
C#
69 lines
2.4 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|
|
|
#nullable disable
|
|
|
|
namespace PizzeriaDatabaseImplement.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddImplementer : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "ImplementerId",
|
|
table: "Orders",
|
|
type: "integer",
|
|
nullable: true);
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Implementers",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
ImplementerFIO = table.Column<string>(type: "text", nullable: false),
|
|
WorkExperience = table.Column<int>(type: "integer", nullable: false),
|
|
Qualification = table.Column<int>(type: "integer", nullable: false),
|
|
Password = table.Column<string>(type: "text", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Implementers", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Orders_ImplementerId",
|
|
table: "Orders",
|
|
column: "ImplementerId");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Orders_Implementers_ImplementerId",
|
|
table: "Orders",
|
|
column: "ImplementerId",
|
|
principalTable: "Implementers",
|
|
principalColumn: "Id");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Orders_Implementers_ImplementerId",
|
|
table: "Orders");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Implementers");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_Orders_ImplementerId",
|
|
table: "Orders");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "ImplementerId",
|
|
table: "Orders");
|
|
}
|
|
}
|
|
}
|