mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-20 04:01:28 +00:00
Forgot the migration file
This commit is contained in:
parent
af0e5bd424
commit
5865f7eb0e
1 changed files with 94 additions and 0 deletions
94
ProjectLighthouse/Migrations/20220923042831_AddPlaylists.cs
Normal file
94
ProjectLighthouse/Migrations/20220923042831_AddPlaylists.cs
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
using LBPUnion.ProjectLighthouse;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace ProjectLighthouse.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(Database))]
|
||||||
|
[Migration("20220923042831_AddPlaylists")]
|
||||||
|
public partial class AddPlaylists : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Playlists",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
PlaylistId = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||||
|
Name = table.Column<string>(type: "longtext", nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
Description = table.Column<string>(type: "longtext", nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
CreatorId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
SlotCollection = table.Column<string>(type: "longtext", nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4")
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Playlists", x => x.PlaylistId);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Playlists_Users_CreatorId",
|
||||||
|
column: x => x.CreatorId,
|
||||||
|
principalTable: "Users",
|
||||||
|
principalColumn: "UserId",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
})
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "HeartedPlaylists",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
HeartedPlaylistId = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||||
|
UserId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
PlaylistId = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_HeartedPlaylists", x => x.HeartedPlaylistId);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_HeartedPlaylists_Playlists_PlaylistId",
|
||||||
|
column: x => x.PlaylistId,
|
||||||
|
principalTable: "Playlists",
|
||||||
|
principalColumn: "PlaylistId",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_HeartedPlaylists_Users_UserId",
|
||||||
|
column: x => x.UserId,
|
||||||
|
principalTable: "Users",
|
||||||
|
principalColumn: "UserId",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
})
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_HeartedPlaylists_PlaylistId",
|
||||||
|
table: "HeartedPlaylists",
|
||||||
|
column: "PlaylistId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_HeartedPlaylists_UserId",
|
||||||
|
table: "HeartedPlaylists",
|
||||||
|
column: "UserId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Playlists_CreatorId",
|
||||||
|
table: "Playlists",
|
||||||
|
column: "CreatorId");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "HeartedPlaylists");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Playlists");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue