48 lines
1.8 KiB
C#
48 lines
1.8 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Metadata;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
namespace ReallifeGamemode.Database.Migrations
|
|
{
|
|
public partial class AddCannabisPlants : Migration
|
|
{
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "CannabisPlants",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<long>(nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
PlantDate = table.Column<DateTime>(nullable: false),
|
|
X = table.Column<float>(nullable: false),
|
|
Y = table.Column<float>(nullable: false),
|
|
Z = table.Column<float>(nullable: false),
|
|
Harvested = table.Column<bool>(nullable: false),
|
|
PlantedById = table.Column<int>(nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_CannabisPlants", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_CannabisPlants_Users_PlantedById",
|
|
column: x => x.PlantedById,
|
|
principalTable: "Users",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_CannabisPlants_PlantedById",
|
|
table: "CannabisPlants",
|
|
column: "PlantedById");
|
|
}
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "CannabisPlants");
|
|
}
|
|
}
|
|
}
|