using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace CompanyManagment.EFCore.Migrations { /// public partial class LoanAndFineTable : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Fines", columns: table => new { id = table.Column(type: "bigint", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), EmployeeId = table.Column(type: "bigint", nullable: false), WorkshopId = table.Column(type: "bigint", nullable: false), Title = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: true), Amount = table.Column(type: "float", nullable: false), IsActive = table.Column(type: "nvarchar(1)", maxLength: 1, nullable: false), FineDate = table.Column(type: "datetime2", nullable: false), CreationDate = table.Column(type: "datetime2", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Fines", x => x.id); }); migrationBuilder.CreateTable( name: "Loan", columns: table => new { id = table.Column(type: "bigint", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), EmployeeId = table.Column(type: "bigint", nullable: false), WorkshopId = table.Column(type: "bigint", nullable: false), StartDateTime = table.Column(type: "datetime2", nullable: false), Count = table.Column(type: "nvarchar(3)", maxLength: 3, nullable: true), Amount = table.Column(type: "float", nullable: false), AmountPerMonth = table.Column(type: "float", nullable: false), GetRounded = table.Column(type: "bit", nullable: false), CreationDate = table.Column(type: "datetime2", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Loan", x => x.id); }); migrationBuilder.CreateTable( name: "LoanInstallment", columns: table => new { LoanId = table.Column(type: "bigint", nullable: false), Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), AmountForMonth = table.Column(type: "float", nullable: false), Month = table.Column(type: "nvarchar(2)", maxLength: 2, nullable: true), Year = table.Column(type: "nvarchar(4)", maxLength: 4, nullable: true), IsActive = table.Column(type: "nvarchar(1)", maxLength: 1, nullable: false) }, constraints: table => { table.PrimaryKey("PK_LoanInstallment", x => new { x.LoanId, x.Id }); table.ForeignKey( name: "FK_LoanInstallment_Loan_LoanId", column: x => x.LoanId, principalTable: "Loan", principalColumn: "id", onDelete: ReferentialAction.Cascade); }); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Fines"); migrationBuilder.DropTable( name: "LoanInstallment"); migrationBuilder.DropTable( name: "Loan"); } } }