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_type = table.Column<int>(type: "integer", maxLength: 255, nullable: false, comment: "вид деятельности"),
                    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: false, comment: "номер телефона"),
                    position = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false, comment: "должность"),
                    company = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false, comment: "компания")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_contact", x => x.id);
                    table.ForeignKey(
                        name: "FK_t_contact_t_company_type_id_company_type",
                        column: x => x.id_company_type,
                        principalTable: "t_company_type",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "Контакты");

            migrationBuilder.CreateIndex(
                name: "IX_t_contact_id_company_type",
                table: "t_contact",
                column: "id_company_type");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "t_contact");
        }
    }
}