Files
reallife-gamemode/ReallifeGamemode.Server/Migrations/20190728142431_HouseEnhancments.cs
2020-05-10 22:54:18 +02:00

74 lines
2.3 KiB
C#

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<bool>(
name: "CanRentIn",
table: "Houses",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<int>(
name: "RentalFee",
table: "Houses",
nullable: false,
defaultValue: 0);
migrationBuilder.CreateTable(
name: "HouseRentals",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
HouseId = table.Column<int>(nullable: true),
UserId = table.Column<int>(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");
}
}
}