Add relationships feature and EF migration
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace RecNet.Infrastructure.Persistence.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Relationships : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Relationships",
|
||||
columns: table => new
|
||||
{
|
||||
OwnerProfileId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
ProfileId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
Muted = table.Column<bool>(type: "boolean", nullable: false),
|
||||
Ignored = table.Column<bool>(type: "boolean", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Relationships", x => new { x.OwnerProfileId, x.ProfileId });
|
||||
table.ForeignKey(
|
||||
name: "FK_Relationships_Profiles_OwnerProfileId",
|
||||
column: x => x.OwnerProfileId,
|
||||
principalTable: "Profiles",
|
||||
principalColumn: "ProfileId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_Relationships_Profiles_ProfileId",
|
||||
column: x => x.ProfileId,
|
||||
principalTable: "Profiles",
|
||||
principalColumn: "ProfileId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Relationships_ProfileId",
|
||||
table: "Relationships",
|
||||
column: "ProfileId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Relationships");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user