mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-01 18:57:24 +00:00
Adds the media consumption history migration
This commit is contained in:
1 parent
f777af07cf
commit
bc65e35de7
4 files changed
+4279
-7
No files matched your search
@@ -73,11 +73,11 @@ public class LibraryConfiguration : IEntityTypeConfiguration<LibraryEntity>
|
||||
|
||||
builder.Property(library => library.ShouldTrackConsumptionProgress)
|
||||
.HasDefaultValue(false)
|
||||
.HasColumnOrder(12);
|
||||
.HasColumnOrder(16);
|
||||
|
||||
builder.Property(library => library.CompletionThresholdPercentage)
|
||||
.HasDefaultValue(null)
|
||||
.HasColumnOrder(13);
|
||||
.HasColumnOrder(17);
|
||||
|
||||
// one user with many libraries
|
||||
builder.HasOne(library => library.User)
|
||||
@@ -138,18 +138,18 @@ public class LibraryConfiguration : IEntityTypeConfiguration<LibraryEntity>
|
||||
// audit
|
||||
builder.Property(library => library.CreatedOnUtc)
|
||||
.IsRequired()
|
||||
.HasColumnOrder(14);
|
||||
.HasColumnOrder(12);
|
||||
|
||||
builder.Property(library => library.CreatedBy)
|
||||
.IsRequired()
|
||||
.HasColumnOrder(15);
|
||||
.HasColumnOrder(13);
|
||||
|
||||
builder.Property(library => library.UpdatedOnUtc)
|
||||
.HasDefaultValue(null)
|
||||
.HasColumnOrder(16);
|
||||
.HasColumnOrder(14);
|
||||
|
||||
builder.Property(library => library.UpdatedBy)
|
||||
.HasDefaultValue(null)
|
||||
.HasColumnOrder(17);
|
||||
.HasColumnOrder(15);
|
||||
}
|
||||
}
|
||||
Generated
+3970
File diff suppressed because it is too large.
Load diff
+108
@@ -0,0 +1,108 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Lumina.DataAccess.Common.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddsMediaConsumptionHistory : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "MediaConsumptionRecords",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
UserId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
LibraryId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
MediaItemId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
MediaKind = table.Column<string>(type: "TEXT", maxLength: 20, nullable: false),
|
||||
Status = table.Column<string>(type: "TEXT", maxLength: 20, nullable: false),
|
||||
StartedOnUtc = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||
LastActivityOnUtc = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||
EndedOnUtc = table.Column<DateTime>(type: "TEXT", nullable: true),
|
||||
ConsumedDurationMilliseconds = table.Column<long>(type: "INTEGER", nullable: false),
|
||||
LastPositionKind = table.Column<string>(type: "TEXT", maxLength: 20, nullable: true),
|
||||
LastPositionTimeOffsetMilliseconds = table.Column<long>(type: "INTEGER", nullable: true),
|
||||
LastPositionLocation = table.Column<string>(type: "TEXT", maxLength: 4096, nullable: true),
|
||||
LastProgressFraction = table.Column<double>(type: "REAL", nullable: false),
|
||||
ConsecutivePagesRead = table.Column<int>(type: "INTEGER", nullable: false, defaultValue: 0),
|
||||
Version = table.Column<long>(type: "INTEGER", nullable: false),
|
||||
CreatedOnUtc = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||
CreatedBy = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
UpdatedOnUtc = table.Column<DateTime>(type: "TEXT", nullable: true),
|
||||
UpdatedBy = table.Column<Guid>(type: "TEXT", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MediaConsumptionRecords", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_MediaConsumptionRecords_Users_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "MediaResumePoints",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
UserId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
LibraryId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
MediaKind = table.Column<string>(type: "TEXT", maxLength: 20, nullable: false),
|
||||
MediaItemId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
LastPositionKind = table.Column<string>(type: "TEXT", maxLength: 20, nullable: false),
|
||||
LastPositionTimeOffsetMilliseconds = table.Column<long>(type: "INTEGER", nullable: true),
|
||||
LastPositionLocation = table.Column<string>(type: "TEXT", maxLength: 4096, nullable: true),
|
||||
LastProgressFraction = table.Column<double>(type: "REAL", nullable: false),
|
||||
LastConsumedOnUtc = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||
Version = table.Column<long>(type: "INTEGER", nullable: false),
|
||||
CreatedOnUtc = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||
CreatedBy = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
UpdatedOnUtc = table.Column<DateTime>(type: "TEXT", nullable: true),
|
||||
UpdatedBy = table.Column<Guid>(type: "TEXT", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MediaResumePoints", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_MediaResumePoints_Users_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MediaConsumptionRecords_UserId_MediaKind_MediaItemId_LastActivityOnUtc",
|
||||
table: "MediaConsumptionRecords",
|
||||
columns: new[] { "UserId", "MediaKind", "MediaItemId", "LastActivityOnUtc" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MediaConsumptionRecords_UserId_MediaKind_StartedOnUtc",
|
||||
table: "MediaConsumptionRecords",
|
||||
columns: new[] { "UserId", "MediaKind", "StartedOnUtc" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MediaResumePoints_UserId_MediaKind_MediaItemId",
|
||||
table: "MediaResumePoints",
|
||||
columns: new[] { "UserId", "MediaKind", "MediaItemId" },
|
||||
unique: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "MediaConsumptionRecords");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "MediaResumePoints");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// <auto-generated />
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Lumina.DataAccess.Core.UoW;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
@@ -347,6 +347,182 @@ namespace Lumina.DataAccess.Common.Migrations
|
||||
b.ToTable("Favorites", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaConsumption.MediaConsumptionRecordEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(0);
|
||||
|
||||
b.Property<int>("ConsecutivePagesRead")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER")
|
||||
.HasDefaultValue(0)
|
||||
.HasColumnOrder(14);
|
||||
|
||||
b.Property<long>("ConsumedDurationMilliseconds")
|
||||
.HasColumnType("INTEGER")
|
||||
.HasColumnOrder(9);
|
||||
|
||||
b.Property<Guid>("CreatedBy")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(17);
|
||||
|
||||
b.Property<DateTime>("CreatedOnUtc")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(16);
|
||||
|
||||
b.Property<DateTime?>("EndedOnUtc")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(8);
|
||||
|
||||
b.Property<DateTime>("LastActivityOnUtc")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(7);
|
||||
|
||||
b.Property<string>("LastPositionKind")
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(10);
|
||||
|
||||
b.Property<string>("LastPositionLocation")
|
||||
.HasMaxLength(4096)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(12);
|
||||
|
||||
b.Property<long?>("LastPositionTimeOffsetMilliseconds")
|
||||
.HasColumnType("INTEGER")
|
||||
.HasColumnOrder(11);
|
||||
|
||||
b.Property<double>("LastProgressFraction")
|
||||
.HasColumnType("REAL")
|
||||
.HasColumnOrder(13);
|
||||
|
||||
b.Property<Guid>("LibraryId")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(2);
|
||||
|
||||
b.Property<Guid>("MediaItemId")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(3);
|
||||
|
||||
b.Property<string>("MediaKind")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(4);
|
||||
|
||||
b.Property<DateTime>("StartedOnUtc")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(6);
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(5);
|
||||
|
||||
b.Property<Guid?>("UpdatedBy")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(19);
|
||||
|
||||
b.Property<DateTime?>("UpdatedOnUtc")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(18);
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(1);
|
||||
|
||||
b.Property<long>("Version")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("INTEGER")
|
||||
.HasColumnOrder(15);
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId", "MediaKind", "StartedOnUtc");
|
||||
|
||||
b.HasIndex("UserId", "MediaKind", "MediaItemId", "LastActivityOnUtc");
|
||||
|
||||
b.ToTable("MediaConsumptionRecords", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaConsumption.MediaResumePointEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(0);
|
||||
|
||||
b.Property<Guid>("CreatedBy")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(12);
|
||||
|
||||
b.Property<DateTime>("CreatedOnUtc")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(11);
|
||||
|
||||
b.Property<DateTime>("LastConsumedOnUtc")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(9);
|
||||
|
||||
b.Property<string>("LastPositionKind")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(5);
|
||||
|
||||
b.Property<string>("LastPositionLocation")
|
||||
.HasMaxLength(4096)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(7);
|
||||
|
||||
b.Property<long?>("LastPositionTimeOffsetMilliseconds")
|
||||
.HasColumnType("INTEGER")
|
||||
.HasColumnOrder(6);
|
||||
|
||||
b.Property<double>("LastProgressFraction")
|
||||
.HasColumnType("REAL")
|
||||
.HasColumnOrder(8);
|
||||
|
||||
b.Property<Guid>("LibraryId")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(2);
|
||||
|
||||
b.Property<Guid>("MediaItemId")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(4);
|
||||
|
||||
b.Property<string>("MediaKind")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(3);
|
||||
|
||||
b.Property<Guid?>("UpdatedBy")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(14);
|
||||
|
||||
b.Property<DateTime?>("UpdatedOnUtc")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(13);
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(1);
|
||||
|
||||
b.Property<long>("Version")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("INTEGER")
|
||||
.HasColumnOrder(10);
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId", "MediaKind", "MediaItemId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("MediaResumePoints", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaContributors.MediaContributorEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
@@ -2906,6 +3082,24 @@ namespace Lumina.DataAccess.Common.Migrations
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaConsumption.MediaConsumptionRecordEntity", b =>
|
||||
{
|
||||
b.HasOne("Lumina.Application.Common.DataAccess.Entities.UsersManagement.UserEntity", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaConsumption.MediaResumePointEntity", b =>
|
||||
{
|
||||
b.HasOne("Lumina.Application.Common.DataAccess.Entities.UsersManagement.UserEntity", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary.AlbumContributorEntity", b =>
|
||||
{
|
||||
b.HasOne("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary.AlbumEntity", null)
|
||||
|
||||
Reference in new issue
Block a user