forked from ddrilling/AsbCloudServer
49 lines
2.1 KiB
C#
49 lines
2.1 KiB
C#
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|||
|
|
|||
|
#nullable disable
|
|||
|
|
|||
|
namespace AsbCloudDb.Migrations
|
|||
|
{
|
|||
|
public partial class Add_Contacts : Migration
|
|||
|
{
|
|||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|||
|
{
|
|||
|
migrationBuilder.CreateTable(
|
|||
|
name: "t_contact",
|
|||
|
columns: table => new
|
|||
|
{
|
|||
|
id = table.Column<int>(type: "integer", nullable: false)
|
|||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|||
|
id_company = table.Column<int>(type: "integer", nullable: false),
|
|||
|
fio = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false, comment: "ФИО"),
|
|||
|
email = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false, comment: "email"),
|
|||
|
phone = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: true, comment: "номер телефона"),
|
|||
|
position = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true, comment: "должность")
|
|||
|
},
|
|||
|
constraints: table =>
|
|||
|
{
|
|||
|
table.PrimaryKey("PK_t_contact", x => x.id);
|
|||
|
table.ForeignKey(
|
|||
|
name: "FK_t_contact_t_company_id_company",
|
|||
|
column: x => x.id_company,
|
|||
|
principalTable: "t_company",
|
|||
|
principalColumn: "id",
|
|||
|
onDelete: ReferentialAction.Cascade);
|
|||
|
},
|
|||
|
comment: "Контакты");
|
|||
|
|
|||
|
migrationBuilder.CreateIndex(
|
|||
|
name: "IX_t_contact_id_company",
|
|||
|
table: "t_contact",
|
|||
|
column: "id_company");
|
|||
|
}
|
|||
|
|
|||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|||
|
{
|
|||
|
migrationBuilder.DropTable(
|
|||
|
name: "t_contact");
|
|||
|
}
|
|||
|
}
|
|||
|
}
|