using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace CalendarReminder.Api.Migrations { /// public partial class AddReminderShares : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "ReminderShares", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), ReminderId = table.Column(type: "int", nullable: false), SharedWithUserId = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_ReminderShares", x => x.Id); table.ForeignKey( name: "FK_ReminderShares_Reminders_ReminderId", column: x => x.ReminderId, principalTable: "Reminders", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_ReminderShares_Users_SharedWithUserId", column: x => x.SharedWithUserId, principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateIndex( name: "IX_ReminderShares_ReminderId_SharedWithUserId", table: "ReminderShares", columns: new[] { "ReminderId", "SharedWithUserId" }, unique: true); migrationBuilder.CreateIndex( name: "IX_ReminderShares_SharedWithUserId", table: "ReminderShares", column: "SharedWithUserId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "ReminderShares"); } } }