| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- using System;
- using Microsoft.EntityFrameworkCore.Migrations;
-
- #nullable disable
-
- namespace Diligent.WebAPI.Data.Migrations
- {
- public partial class Initial : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.CreateTable(
- name: "InsuranceCompanies",
- columns: table => new
- {
- Id = table.Column<long>(type: "bigint", nullable: false)
- .Annotation("SqlServer:Identity", "1, 1"),
- Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
- PhoneNumber = table.Column<string>(type: "nvarchar(max)", nullable: false),
- Fax = table.Column<string>(type: "nvarchar(max)", nullable: false),
- City = table.Column<string>(type: "nvarchar(max)", nullable: false),
- Country = table.Column<string>(type: "nvarchar(max)", nullable: false),
- PostalCode = table.Column<string>(type: "nvarchar(max)", nullable: false),
- LegalAddress = table.Column<string>(type: "nvarchar(max)", nullable: false),
- LegalEmail = table.Column<string>(type: "nvarchar(max)", nullable: false),
- CreatedAtUtc = table.Column<DateTime>(type: "datetime2", nullable: false),
- UpdatedAtUtc = table.Column<DateTime>(type: "datetime2", nullable: true),
- DeletedAtUtc = table.Column<DateTime>(type: "datetime2", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_InsuranceCompanies", x => x.Id);
- });
-
- migrationBuilder.CreateTable(
- name: "Insurers",
- columns: table => new
- {
- Id = table.Column<long>(type: "bigint", nullable: false)
- .Annotation("SqlServer:Identity", "1, 1"),
- FirstName = table.Column<string>(type: "nvarchar(max)", nullable: false),
- LastName = table.Column<string>(type: "nvarchar(max)", nullable: false),
- DateOfBirth = table.Column<DateTime>(type: "datetime2", nullable: false),
- PhoneNumber = table.Column<string>(type: "nvarchar(max)", nullable: false),
- City = table.Column<string>(type: "nvarchar(max)", nullable: false),
- Country = table.Column<string>(type: "nvarchar(max)", nullable: false),
- PostalCode = table.Column<string>(type: "nvarchar(max)", nullable: false),
- Address = table.Column<string>(type: "nvarchar(max)", nullable: false),
- Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
- InsuranceCompanyId = table.Column<long>(type: "bigint", nullable: false),
- CreatedAtUtc = table.Column<DateTime>(type: "datetime2", nullable: false),
- UpdatedAtUtc = table.Column<DateTime>(type: "datetime2", nullable: true),
- DeletedAtUtc = table.Column<DateTime>(type: "datetime2", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Insurers", x => x.Id);
- table.ForeignKey(
- name: "FK_Insurers_InsuranceCompanies_InsuranceCompanyId",
- column: x => x.InsuranceCompanyId,
- principalTable: "InsuranceCompanies",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateTable(
- name: "InsurancePolicies",
- columns: table => new
- {
- Id = table.Column<long>(type: "bigint", nullable: false)
- .Annotation("SqlServer:Identity", "1, 1"),
- Premium = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
- StartDate = table.Column<DateTime>(type: "datetime2", nullable: false),
- EndDate = table.Column<DateTime>(type: "datetime2", nullable: false),
- Type = table.Column<string>(type: "nvarchar(max)", nullable: false),
- InsurerId = table.Column<long>(type: "bigint", nullable: false),
- CreatedAtUtc = table.Column<DateTime>(type: "datetime2", nullable: false),
- UpdatedAtUtc = table.Column<DateTime>(type: "datetime2", nullable: true),
- DeletedAtUtc = table.Column<DateTime>(type: "datetime2", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_InsurancePolicies", x => x.Id);
- table.ForeignKey(
- name: "FK_InsurancePolicies_Insurers_InsurerId",
- column: x => x.InsurerId,
- principalTable: "Insurers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateIndex(
- name: "IX_InsurancePolicies_InsurerId",
- table: "InsurancePolicies",
- column: "InsurerId");
-
- migrationBuilder.CreateIndex(
- name: "IX_Insurers_InsuranceCompanyId",
- table: "Insurers",
- column: "InsuranceCompanyId");
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "InsurancePolicies");
-
- migrationBuilder.DropTable(
- name: "Insurers");
-
- migrationBuilder.DropTable(
- name: "InsuranceCompanies");
- }
- }
- }
|