Add project files.
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CalendarReminder.Api.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddReminderShares : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ReminderShares",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
ReminderId = table.Column<int>(type: "int", nullable: false),
|
||||
SharedWithUserId = table.Column<int>(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");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "ReminderShares");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user