using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace FlowAPI.Infrastructure.Migrations { /// public partial class AddSharedGraphs : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "SharedGraphs", columns: table => new { Id = table.Column(type: "TEXT", nullable: false), GraphId = table.Column(type: "TEXT", nullable: false), SharedWithUserId = table.Column(type: "TEXT", nullable: false), Permission = table.Column(type: "TEXT", maxLength: 50, nullable: false, defaultValue: "Read"), CreatedAt = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_SharedGraphs", x => x.Id); table.ForeignKey( name: "FK_SharedGraphs_Graphs_GraphId", column: x => x.GraphId, principalTable: "Graphs", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_SharedGraphs_Users_SharedWithUserId", column: x => x.SharedWithUserId, principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_SharedGraphs_GraphId_SharedWithUserId", table: "SharedGraphs", columns: new[] { "GraphId", "SharedWithUserId" }, unique: true); migrationBuilder.CreateIndex( name: "IX_SharedGraphs_SharedWithUserId", table: "SharedGraphs", column: "SharedWithUserId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "SharedGraphs"); } } }