forked from SoDOff-Project/sodoff
add `Id
field to
Buddy
`
This commit is contained in:
parent
3ba60972ad
commit
c37a719aad
1316
src/Migrations/20250306190354_Buddies_Id.Designer.cs
generated
Normal file
1316
src/Migrations/20250306190354_Buddies_Id.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
57
src/Migrations/20250306190354_Buddies_Id.cs
Normal file
57
src/Migrations/20250306190354_Buddies_Id.cs
Normal file
@ -0,0 +1,57 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace sodoff.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Buddies_Id : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_Buddies",
|
||||
table: "Buddies");
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "Id",
|
||||
table: "Buddies",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: 0)
|
||||
.Annotation("Sqlite:Autoincrement", true);
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_Buddies",
|
||||
table: "Buddies",
|
||||
column: "Id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Buddies_VikingId",
|
||||
table: "Buddies",
|
||||
column: "VikingId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_Buddies",
|
||||
table: "Buddies");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Buddies_VikingId",
|
||||
table: "Buddies");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Id",
|
||||
table: "Buddies");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_Buddies",
|
||||
table: "Buddies",
|
||||
column: "VikingId");
|
||||
}
|
||||
}
|
||||
}
|
@ -72,7 +72,8 @@ namespace sodoff.Migrations
|
||||
|
||||
modelBuilder.Entity("sodoff.Model.Buddy", b =>
|
||||
{
|
||||
b.Property<int>("VikingId")
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("BuddyStatus1")
|
||||
@ -93,10 +94,15 @@ namespace sodoff.Migrations
|
||||
b.Property<bool>("IsBestFriend2")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("VikingId");
|
||||
b.Property<int>("VikingId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("BuddyVikingId");
|
||||
|
||||
b.HasIndex("VikingId");
|
||||
|
||||
b.ToTable("Buddies");
|
||||
});
|
||||
|
||||
|
@ -5,9 +5,10 @@ using sodoff.Schema;
|
||||
|
||||
namespace sodoff.Model;
|
||||
|
||||
[PrimaryKey(nameof(VikingId))]
|
||||
public class Buddy
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
public int VikingId { get; set; }
|
||||
public int BuddyVikingId { get; set; }
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user