using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; namespace ReallifeGamemode.Database.Migrations { public partial class HouseEnhancments : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "CanRentIn", table: "Houses", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "RentalFee", table: "Houses", nullable: false, defaultValue: 0); migrationBuilder.CreateTable( name: "HouseRentals", columns: table => new { Id = table.Column(nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), HouseId = table.Column(nullable: true), UserId = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_HouseRentals", x => x.Id); table.ForeignKey( name: "FK_HouseRentals_Houses_HouseId", column: x => x.HouseId, principalTable: "Houses", principalColumn: "Id", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_HouseRentals_Users_UserId", column: x => x.UserId, principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateIndex( name: "IX_HouseRentals_HouseId", table: "HouseRentals", column: "HouseId"); migrationBuilder.CreateIndex( name: "IX_HouseRentals_UserId", table: "HouseRentals", column: "UserId"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "HouseRentals"); migrationBuilder.DropColumn( name: "CanRentIn", table: "Houses"); migrationBuilder.DropColumn( name: "RentalFee", table: "Houses"); } } }