-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
21e57a5
commit 84567cc
Showing
9 changed files
with
1,015 additions
and
13 deletions.
There are no files selected for viewing
821 changes: 821 additions & 0 deletions
821
OneShelf.Videos/OneShelf.Videos.Database/Migrations/20240927135124_Media2.Designer.cs
Large diffs are not rendered by default.
Oops, something went wrong.
76 changes: 76 additions & 0 deletions
76
OneShelf.Videos/OneShelf.Videos.Database/Migrations/20240927135124_Media2.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
using Microsoft.EntityFrameworkCore.Migrations; | ||
|
||
#nullable disable | ||
|
||
namespace OneShelf.Videos.Database.Migrations.VideosDatabaseMigrations | ||
{ | ||
/// <inheritdoc /> | ||
public partial class Media2 : Migration | ||
{ | ||
/// <inheritdoc /> | ||
protected override void Up(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.CreateTable( | ||
name: "Mediae", | ||
columns: table => new | ||
{ | ||
Id = table.Column<int>(type: "int", nullable: false) | ||
.Annotation("SqlServer:Identity", "1, 1"), | ||
StaticChatId = table.Column<long>(type: "bigint", nullable: true), | ||
StaticMessageId = table.Column<int>(type: "int", nullable: true), | ||
LiveChatId = table.Column<long>(type: "bigint", nullable: true), | ||
LiveMediaId = table.Column<int>(type: "int", nullable: true) | ||
}, | ||
constraints: table => | ||
{ | ||
table.PrimaryKey("PK_Mediae", x => x.Id); | ||
table.ForeignKey( | ||
name: "FK_Mediae_LiveChats_LiveChatId", | ||
column: x => x.LiveChatId, | ||
principalTable: "LiveChats", | ||
principalColumn: "Id"); | ||
table.ForeignKey( | ||
name: "FK_Mediae_LiveMediae_LiveMediaId_LiveChatId", | ||
columns: x => new { x.LiveMediaId, x.LiveChatId }, | ||
principalTable: "LiveMediae", | ||
principalColumns: new[] { "Id", "LiveTopicLiveChatId" }); | ||
table.ForeignKey( | ||
name: "FK_Mediae_StaticChats_StaticChatId", | ||
column: x => x.StaticChatId, | ||
principalTable: "StaticChats", | ||
principalColumn: "Id"); | ||
table.ForeignKey( | ||
name: "FK_Mediae_StaticMessages_StaticChatId_StaticMessageId", | ||
columns: x => new { x.StaticChatId, x.StaticMessageId }, | ||
principalTable: "StaticMessages", | ||
principalColumns: new[] { "StaticChatId", "Id" }); | ||
}); | ||
|
||
migrationBuilder.CreateIndex( | ||
name: "IX_Mediae_LiveChatId", | ||
table: "Mediae", | ||
column: "LiveChatId"); | ||
|
||
migrationBuilder.CreateIndex( | ||
name: "IX_Mediae_LiveMediaId_LiveChatId", | ||
table: "Mediae", | ||
columns: new[] { "LiveMediaId", "LiveChatId" }, | ||
unique: true, | ||
filter: "[LiveMediaId] IS NOT NULL AND [LiveChatId] IS NOT NULL"); | ||
|
||
migrationBuilder.CreateIndex( | ||
name: "IX_Mediae_StaticChatId_StaticMessageId", | ||
table: "Mediae", | ||
columns: new[] { "StaticChatId", "StaticMessageId" }, | ||
unique: true, | ||
filter: "[StaticChatId] IS NOT NULL AND [StaticMessageId] IS NOT NULL"); | ||
} | ||
|
||
/// <inheritdoc /> | ||
protected override void Down(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.DropTable( | ||
name: "Mediae"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,21 @@ | ||
using OneShelf.Videos.Database.Models.Static; | ||
using OneShelf.Videos.Database.Models.Live; | ||
using OneShelf.Videos.Database.Models.Static; | ||
|
||
namespace OneShelf.Videos.Database.Models; | ||
|
||
//public class Media | ||
//{ | ||
// public int Id { get; set; } | ||
public class Media | ||
{ | ||
public int Id { get; set; } | ||
|
||
// public long? StaticChatId { get; init; } | ||
// public int? StaticMessageId { get; init; } | ||
public long? StaticChatId { get; set; } | ||
public int? StaticMessageId { get; set; } | ||
|
||
// public StaticChat? StaticChat { get; init; } | ||
// public StaticMessage? StaticMessage { get; init; } | ||
//} | ||
public StaticChat? StaticChat { get; set; } | ||
public StaticMessage? StaticMessage { get; set; } | ||
|
||
public long? LiveChatId { get; set; } | ||
public int? LiveMediaId { get; set; } | ||
|
||
public LiveChat? LiveChat { get; set; } | ||
public LiveMedia? LiveMedia { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters