using Microsoft.EntityFrameworkCore.Migrations;

namespace isndhost.Migrations
{
    public partial class pkgVersionCommit : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<long>(
                name: "CommitNId",
                table: "PackageVersions",
                nullable: false,
                defaultValue: 0L);

            migrationBuilder.CreateIndex(
                name: "IX_PackageVersions_CommitNId",
                table: "PackageVersions",
                column: "CommitNId");

            migrationBuilder.AddForeignKey(
                name: "FK_PackageVersions_Commits_CommitNId",
                table: "PackageVersions",
                column: "CommitNId",
                principalTable: "Commits",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_PackageVersions_Commits_CommitNId",
                table: "PackageVersions");

            migrationBuilder.DropIndex(
                name: "IX_PackageVersions_CommitNId",
                table: "PackageVersions");

            migrationBuilder.DropColumn(
                name: "CommitNId",
                table: "PackageVersions");
        }
    }
}
