forked from SoDOff-Project/sodoff
115 lines
3.6 KiB
C#
115 lines
3.6 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace sodoff.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class Buddies_CreateDate : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Buddy_Vikings_BuddyVikingId",
|
|
table: "Buddy");
|
|
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Buddy_Vikings_VikingId",
|
|
table: "Buddy");
|
|
|
|
migrationBuilder.DropPrimaryKey(
|
|
name: "PK_Buddy",
|
|
table: "Buddy");
|
|
|
|
migrationBuilder.RenameTable(
|
|
name: "Buddy",
|
|
newName: "Buddies");
|
|
|
|
migrationBuilder.RenameIndex(
|
|
name: "IX_Buddy_BuddyVikingId",
|
|
table: "Buddies",
|
|
newName: "IX_Buddies_BuddyVikingId");
|
|
|
|
migrationBuilder.AddColumn<DateTime>(
|
|
name: "CreatedAt",
|
|
table: "Buddies",
|
|
type: "TEXT",
|
|
nullable: false,
|
|
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
|
|
|
|
migrationBuilder.AddPrimaryKey(
|
|
name: "PK_Buddies",
|
|
table: "Buddies",
|
|
column: "VikingId");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Buddies_Vikings_BuddyVikingId",
|
|
table: "Buddies",
|
|
column: "BuddyVikingId",
|
|
principalTable: "Vikings",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Buddies_Vikings_VikingId",
|
|
table: "Buddies",
|
|
column: "VikingId",
|
|
principalTable: "Vikings",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Buddies_Vikings_BuddyVikingId",
|
|
table: "Buddies");
|
|
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Buddies_Vikings_VikingId",
|
|
table: "Buddies");
|
|
|
|
migrationBuilder.DropPrimaryKey(
|
|
name: "PK_Buddies",
|
|
table: "Buddies");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "CreatedAt",
|
|
table: "Buddies");
|
|
|
|
migrationBuilder.RenameTable(
|
|
name: "Buddies",
|
|
newName: "Buddy");
|
|
|
|
migrationBuilder.RenameIndex(
|
|
name: "IX_Buddies_BuddyVikingId",
|
|
table: "Buddy",
|
|
newName: "IX_Buddy_BuddyVikingId");
|
|
|
|
migrationBuilder.AddPrimaryKey(
|
|
name: "PK_Buddy",
|
|
table: "Buddy",
|
|
column: "VikingId");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Buddy_Vikings_BuddyVikingId",
|
|
table: "Buddy",
|
|
column: "BuddyVikingId",
|
|
principalTable: "Vikings",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Buddy_Vikings_VikingId",
|
|
table: "Buddy",
|
|
column: "VikingId",
|
|
principalTable: "Vikings",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
}
|
|
}
|
|
}
|