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(type: "bigint", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), Name = table.Column(type: "nvarchar(max)", nullable: false), PhoneNumber = table.Column(type: "nvarchar(max)", nullable: false), Fax = table.Column(type: "nvarchar(max)", nullable: false), City = table.Column(type: "nvarchar(max)", nullable: false), Country = table.Column(type: "nvarchar(max)", nullable: false), PostalCode = table.Column(type: "nvarchar(max)", nullable: false), LegalAddress = table.Column(type: "nvarchar(max)", nullable: false), LegalEmail = table.Column(type: "nvarchar(max)", nullable: false), CreatedAtUtc = table.Column(type: "datetime2", nullable: false), UpdatedAtUtc = table.Column(type: "datetime2", nullable: true), DeletedAtUtc = table.Column(type: "datetime2", nullable: true) }, constraints: table => { table.PrimaryKey("PK_InsuranceCompanies", x => x.Id); }); migrationBuilder.CreateTable( name: "Insurers", columns: table => new { Id = table.Column(type: "bigint", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), FirstName = table.Column(type: "nvarchar(max)", nullable: false), LastName = table.Column(type: "nvarchar(max)", nullable: false), DateOfBirth = table.Column(type: "datetime2", nullable: false), PhoneNumber = table.Column(type: "nvarchar(max)", nullable: false), City = table.Column(type: "nvarchar(max)", nullable: false), Country = table.Column(type: "nvarchar(max)", nullable: false), PostalCode = table.Column(type: "nvarchar(max)", nullable: false), Address = table.Column(type: "nvarchar(max)", nullable: false), Email = table.Column(type: "nvarchar(max)", nullable: false), InsuranceCompanyId = table.Column(type: "bigint", nullable: false), CreatedAtUtc = table.Column(type: "datetime2", nullable: false), UpdatedAtUtc = table.Column(type: "datetime2", nullable: true), DeletedAtUtc = table.Column(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(type: "bigint", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), Premium = table.Column(type: "decimal(18,2)", nullable: false), StartDate = table.Column(type: "datetime2", nullable: false), EndDate = table.Column(type: "datetime2", nullable: false), Type = table.Column(type: "nvarchar(max)", nullable: false), InsurerId = table.Column(type: "bigint", nullable: false), CreatedAtUtc = table.Column(type: "datetime2", nullable: false), UpdatedAtUtc = table.Column(type: "datetime2", nullable: true), DeletedAtUtc = table.Column(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"); } } }