Datenstruktur angepasst
This commit is contained in:
parent
89f5d51580
commit
205fb71316
22
songrequests_blazor/Data/Library.cs
Normal file
22
songrequests_blazor/Data/Library.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace songrequests_blazor.Data
|
||||||
|
{
|
||||||
|
public class Library
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string Name { get; set; } = null!;
|
||||||
|
public List<Song>? Songs { get; set; }
|
||||||
|
public LibraryType Type { get; set; }
|
||||||
|
|
||||||
|
[Column("Sessions_ID")]
|
||||||
|
public virtual List<Session>? UsedInSessions { get; set; }
|
||||||
|
|
||||||
|
public enum LibraryType
|
||||||
|
{
|
||||||
|
Local,
|
||||||
|
Spotify
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -9,10 +9,11 @@ namespace songrequests_blazor.Data
|
|||||||
|
|
||||||
public DbSet<Song> Songs { get; set; }
|
public DbSet<Song> Songs { get; set; }
|
||||||
public DbSet<Session> Sessions { get; set; }
|
public DbSet<Session> Sessions { get; set; }
|
||||||
public DbSet<QueuedSong> QueuedSongs { get; set; }
|
public DbSet<QueuedSong> QueuedSongs { get; set; }
|
||||||
|
public DbSet<Library> Libraries { get; set; }
|
||||||
|
|
||||||
public LocalDbContext(DbContextOptions<LocalDbContext> options) : base(options)
|
public LocalDbContext(DbContextOptions<LocalDbContext> options) : base(options)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||||
{ }
|
{ }
|
||||||
@ -20,6 +21,61 @@ namespace songrequests_blazor.Data
|
|||||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
base.OnModelCreating(modelBuilder);
|
base.OnModelCreating(modelBuilder);
|
||||||
|
|
||||||
|
// // Foreign Keys und dazugehörige Indizes (aus anderem Beispiel, daher andere Klassen- und Spaltennamen)
|
||||||
|
// entity.HasIndex(e => e.MAC_ID, "FK_MAC_ID_idx");
|
||||||
|
// entity.HasOne(d => d.Machine).WithMany(p => p.Logs).HasForeignKey(d => d.MAC_ID).HasConstraintName("FK_log_machine");
|
||||||
|
|
||||||
|
modelBuilder.Entity<Library>(entity =>
|
||||||
|
{
|
||||||
|
entity.HasMany(l => l.Songs).WithOne(s => s.Library).HasForeignKey(s => s.Library_ID).HasConstraintName("FK_library_songs");
|
||||||
|
//entity.HasMany(l => l.UsedInSessions).WithMany(s => s.EnabledLibraries).UsingEntity("Sessions_Libraries");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<QueuedSong>(entity =>
|
||||||
|
{
|
||||||
|
entity.HasOne(qs => qs.Song).WithMany(s => s.Queued).HasForeignKey(s => s.Song_ID).HasConstraintName("FK_queuedsongs_song");
|
||||||
|
entity.HasMany(qs => qs.UserVotes).WithMany(u => u.VotedSongs).UsingEntity("QueuedSongs_UserVotes");
|
||||||
|
entity.HasOne(qs => qs.AdddedBy).WithMany(u => u.AddedSongs).HasForeignKey(qs => qs.AddedBy_User_ID).HasConstraintName("FK_user_addedsongs");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<Session>(entity =>
|
||||||
|
{
|
||||||
|
entity.HasMany(ses => ses.EnabledLibraries).WithMany(l => l.UsedInSessions).UsingEntity("Sessions_Libraries");
|
||||||
|
entity.HasMany(ses => ses.QueuedSongs).WithOne(qs => qs.Session).HasForeignKey(qs => qs.Session_ID).HasConstraintName("FK_Session_QueuedSongs");
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
string AdminRoleGUID = "fc985a25-19ce-48ed-8443-c845f550960a";
|
||||||
|
string AdminUserGUID = "5c2511d0-6a08-4950-babd-d107996749ba";
|
||||||
|
|
||||||
|
modelBuilder.Entity<IdentityRole>().HasData(
|
||||||
|
new IdentityRole { Id = AdminRoleGUID, Name = "Administrator", NormalizedName = "ADMINISTRATOR".ToUpper() }
|
||||||
|
);
|
||||||
|
|
||||||
|
var hasher = new PasswordHasher<IdentityUser>();
|
||||||
|
var AdminUser = new IdentityUser()
|
||||||
|
{
|
||||||
|
Id = AdminUserGUID, // primary key
|
||||||
|
UserName = "admin@admin.com",
|
||||||
|
NormalizedUserName = "ADMIN@ADMIN.COM",
|
||||||
|
Email = "admin@admin.com",
|
||||||
|
NormalizedEmail = "ADMIN@ADMIN.COM"
|
||||||
|
};
|
||||||
|
AdminUser.PasswordHash = hasher.HashPassword(AdminUser, "admin");
|
||||||
|
|
||||||
|
modelBuilder.Entity<IdentityUser>().HasData(AdminUser);
|
||||||
|
|
||||||
|
modelBuilder.Entity<IdentityUserRole<string>>().HasData(
|
||||||
|
new IdentityUserRole<string>
|
||||||
|
{
|
||||||
|
RoleId = AdminRoleGUID,
|
||||||
|
UserId = AdminUserGUID
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// Erweitertes definieren des Datenbankmodells (falls benötigt):
|
// Erweitertes definieren des Datenbankmodells (falls benötigt):
|
||||||
//modelBuilder.Entity<Song>(entity =>
|
//modelBuilder.Entity<Song>(entity =>
|
||||||
//{
|
//{
|
||||||
|
|||||||
@ -4,10 +4,17 @@
|
|||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public int Position { get; set; }
|
public int Position { get; set; }
|
||||||
|
public int Song_ID { get; set; }
|
||||||
public Song Song { get; set; } = null!;
|
public Song Song { get; set; } = null!;
|
||||||
public DateTime Added { get; set; }
|
|
||||||
public DateTime Played { get; set; }
|
public string? AddedBy_User_ID { get; set; }
|
||||||
|
public User? AdddedBy { get; set; }
|
||||||
|
public DateTime Added { get; set; } = DateTime.Now;
|
||||||
|
public DateTime? Played { get; set; }
|
||||||
public List<User>? UserVotes { get; set; }
|
public List<User>? UserVotes { get; set; }
|
||||||
|
|
||||||
|
public int Session_ID { get; set; }
|
||||||
|
public virtual Session Session { get; set; } = null!;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,10 @@
|
|||||||
|
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public string? SessionCode { get; set; }
|
public string? SessionCode { get; set; }
|
||||||
public List<QueuedSong> Queue { get; set; } = null!;
|
public bool Active { get; set; }
|
||||||
public DateTime Created { get; set; }
|
public List<Library> EnabledLibraries { get; set; } = null!;
|
||||||
|
public List<QueuedSong> QueuedSongs { get; set; } = null!;
|
||||||
|
|
||||||
|
public DateTime Created { get; set; } = DateTime.Now;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,7 +7,8 @@ namespace songrequests_blazor.Data
|
|||||||
public class Song
|
public class Song
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
public string Uri { get; set; } = null!;
|
||||||
|
|
||||||
// Tag-Parameter
|
// Tag-Parameter
|
||||||
public string Title { get; set; } = null!;
|
public string Title { get; set; } = null!;
|
||||||
public string? Artist { get; set; }
|
public string? Artist { get; set; }
|
||||||
@ -16,19 +17,14 @@ namespace songrequests_blazor.Data
|
|||||||
public string? Genre { get; set; }
|
public string? Genre { get; set; }
|
||||||
public TimeSpan Length { get; set; }
|
public TimeSpan Length { get; set; }
|
||||||
|
|
||||||
// File-Parameter
|
|
||||||
public SourceType Source { get; set; }
|
|
||||||
public string SourceUri { get; set; } = null!;
|
|
||||||
|
|
||||||
|
|
||||||
// Statistics
|
// Statistics
|
||||||
public int RequestCount { get; set; }
|
public int RequestCount { get; set; }
|
||||||
|
|
||||||
public enum SourceType
|
public int Library_ID { get; set; }
|
||||||
{
|
public virtual Library Library { get; set; } = null!;
|
||||||
LocalFile,
|
|
||||||
Spotify
|
public virtual List<QueuedSong>? Queued { get; set; }
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,5 +5,6 @@ namespace songrequests_blazor.Data
|
|||||||
public class User : IdentityUser
|
public class User : IdentityUser
|
||||||
{
|
{
|
||||||
public List<QueuedSong>? VotedSongs { get; set; }
|
public List<QueuedSong>? VotedSongs { get; set; }
|
||||||
|
public List<QueuedSong>? AddedSongs { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,408 +0,0 @@
|
|||||||
// <auto-generated />
|
|
||||||
using System;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
||||||
using songrequests_blazor.Data;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace songrequests_blazor.Migrations
|
|
||||||
{
|
|
||||||
[DbContext(typeof(LocalDbContext))]
|
|
||||||
[Migration("20240523182804_AddedQueueData")]
|
|
||||||
partial class AddedQueueData
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder.HasAnnotation("ProductVersion", "8.0.5");
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
|
|
||||||
{
|
|
||||||
b.Property<string>("Id")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("ConcurrencyStamp")
|
|
||||||
.IsConcurrencyToken()
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.HasMaxLength(256)
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("NormalizedName")
|
|
||||||
.HasMaxLength(256)
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("NormalizedName")
|
|
||||||
.IsUnique()
|
|
||||||
.HasDatabaseName("RoleNameIndex");
|
|
||||||
|
|
||||||
b.ToTable("AspNetRoles", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<string>("ClaimType")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("ClaimValue")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("RoleId")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("RoleId");
|
|
||||||
|
|
||||||
b.ToTable("AspNetRoleClaims", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b =>
|
|
||||||
{
|
|
||||||
b.Property<string>("Id")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<int>("AccessFailedCount")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<string>("ConcurrencyStamp")
|
|
||||||
.IsConcurrencyToken()
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("Discriminator")
|
|
||||||
.IsRequired()
|
|
||||||
.HasMaxLength(13)
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("Email")
|
|
||||||
.HasMaxLength(256)
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<bool>("EmailConfirmed")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<bool>("LockoutEnabled")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<DateTimeOffset?>("LockoutEnd")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("NormalizedEmail")
|
|
||||||
.HasMaxLength(256)
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("NormalizedUserName")
|
|
||||||
.HasMaxLength(256)
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("PasswordHash")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("PhoneNumber")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<bool>("PhoneNumberConfirmed")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<string>("SecurityStamp")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<bool>("TwoFactorEnabled")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<string>("UserName")
|
|
||||||
.HasMaxLength(256)
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("NormalizedEmail")
|
|
||||||
.HasDatabaseName("EmailIndex");
|
|
||||||
|
|
||||||
b.HasIndex("NormalizedUserName")
|
|
||||||
.IsUnique()
|
|
||||||
.HasDatabaseName("UserNameIndex");
|
|
||||||
|
|
||||||
b.ToTable("AspNetUsers", (string)null);
|
|
||||||
|
|
||||||
b.HasDiscriminator<string>("Discriminator").HasValue("IdentityUser");
|
|
||||||
|
|
||||||
b.UseTphMappingStrategy();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<string>("ClaimType")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("ClaimValue")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("UserId")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("UserId");
|
|
||||||
|
|
||||||
b.ToTable("AspNetUserClaims", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
|
||||||
{
|
|
||||||
b.Property<string>("LoginProvider")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("ProviderKey")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("ProviderDisplayName")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("UserId")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.HasKey("LoginProvider", "ProviderKey");
|
|
||||||
|
|
||||||
b.HasIndex("UserId");
|
|
||||||
|
|
||||||
b.ToTable("AspNetUserLogins", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
|
|
||||||
{
|
|
||||||
b.Property<string>("UserId")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("RoleId")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.HasKey("UserId", "RoleId");
|
|
||||||
|
|
||||||
b.HasIndex("RoleId");
|
|
||||||
|
|
||||||
b.ToTable("AspNetUserRoles", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
|
||||||
{
|
|
||||||
b.Property<string>("UserId")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("LoginProvider")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("Value")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.HasKey("UserId", "LoginProvider", "Name");
|
|
||||||
|
|
||||||
b.ToTable("AspNetUserTokens", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("songrequests_blazor.Data.QueuedSong", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<DateTime>("Added")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<DateTime>("Played")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<int>("Position")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<int?>("SessionId")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<int>("SongId")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("SessionId");
|
|
||||||
|
|
||||||
b.HasIndex("SongId");
|
|
||||||
|
|
||||||
b.ToTable("QueuedSongs");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("songrequests_blazor.Data.Session", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<DateTime>("Created")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("SessionCode")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Sessions");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("songrequests_blazor.Data.Song", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<string>("Album")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("Artist")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("Genre")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<TimeSpan>("Length")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<int>("RequestCount")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<int>("Source")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<string>("SourceUri")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("Title")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<int?>("Year")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Songs");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("songrequests_blazor.Data.User", b =>
|
|
||||||
{
|
|
||||||
b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser");
|
|
||||||
|
|
||||||
b.Property<int?>("QueuedSongId")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.HasIndex("QueuedSongId");
|
|
||||||
|
|
||||||
b.HasDiscriminator().HasValue("User");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("RoleId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("UserId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("UserId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("RoleId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("UserId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("UserId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("songrequests_blazor.Data.QueuedSong", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("songrequests_blazor.Data.Session", null)
|
|
||||||
.WithMany("Queue")
|
|
||||||
.HasForeignKey("SessionId");
|
|
||||||
|
|
||||||
b.HasOne("songrequests_blazor.Data.Song", "Song")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("SongId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Song");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("songrequests_blazor.Data.User", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("songrequests_blazor.Data.QueuedSong", null)
|
|
||||||
.WithMany("Votes")
|
|
||||||
.HasForeignKey("QueuedSongId");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("songrequests_blazor.Data.QueuedSong", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Votes");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("songrequests_blazor.Data.Session", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Queue");
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,130 +0,0 @@
|
|||||||
using System;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace songrequests_blazor.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class AddedQueueData : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.AddColumn<int>(
|
|
||||||
name: "RequestCount",
|
|
||||||
table: "Songs",
|
|
||||||
type: "INTEGER",
|
|
||||||
nullable: false,
|
|
||||||
defaultValue: 0);
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<string>(
|
|
||||||
name: "Discriminator",
|
|
||||||
table: "AspNetUsers",
|
|
||||||
type: "TEXT",
|
|
||||||
maxLength: 13,
|
|
||||||
nullable: false,
|
|
||||||
defaultValue: "");
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<int>(
|
|
||||||
name: "QueuedSongId",
|
|
||||||
table: "AspNetUsers",
|
|
||||||
type: "INTEGER",
|
|
||||||
nullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Sessions",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
|
||||||
.Annotation("Sqlite:Autoincrement", true),
|
|
||||||
SessionCode = table.Column<string>(type: "TEXT", nullable: true),
|
|
||||||
Created = table.Column<DateTime>(type: "TEXT", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Sessions", x => x.Id);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "QueuedSongs",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
|
||||||
.Annotation("Sqlite:Autoincrement", true),
|
|
||||||
Position = table.Column<int>(type: "INTEGER", nullable: false),
|
|
||||||
SongId = table.Column<int>(type: "INTEGER", nullable: false),
|
|
||||||
Added = table.Column<DateTime>(type: "TEXT", nullable: false),
|
|
||||||
Played = table.Column<DateTime>(type: "TEXT", nullable: false),
|
|
||||||
SessionId = table.Column<int>(type: "INTEGER", nullable: true)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_QueuedSongs", x => x.Id);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_QueuedSongs_Sessions_SessionId",
|
|
||||||
column: x => x.SessionId,
|
|
||||||
principalTable: "Sessions",
|
|
||||||
principalColumn: "Id");
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_QueuedSongs_Songs_SongId",
|
|
||||||
column: x => x.SongId,
|
|
||||||
principalTable: "Songs",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_AspNetUsers_QueuedSongId",
|
|
||||||
table: "AspNetUsers",
|
|
||||||
column: "QueuedSongId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_QueuedSongs_SessionId",
|
|
||||||
table: "QueuedSongs",
|
|
||||||
column: "SessionId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_QueuedSongs_SongId",
|
|
||||||
table: "QueuedSongs",
|
|
||||||
column: "SongId");
|
|
||||||
|
|
||||||
migrationBuilder.AddForeignKey(
|
|
||||||
name: "FK_AspNetUsers_QueuedSongs_QueuedSongId",
|
|
||||||
table: "AspNetUsers",
|
|
||||||
column: "QueuedSongId",
|
|
||||||
principalTable: "QueuedSongs",
|
|
||||||
principalColumn: "Id");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropForeignKey(
|
|
||||||
name: "FK_AspNetUsers_QueuedSongs_QueuedSongId",
|
|
||||||
table: "AspNetUsers");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "QueuedSongs");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Sessions");
|
|
||||||
|
|
||||||
migrationBuilder.DropIndex(
|
|
||||||
name: "IX_AspNetUsers_QueuedSongId",
|
|
||||||
table: "AspNetUsers");
|
|
||||||
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "RequestCount",
|
|
||||||
table: "Songs");
|
|
||||||
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "Discriminator",
|
|
||||||
table: "AspNetUsers");
|
|
||||||
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "QueuedSongId",
|
|
||||||
table: "AspNetUsers");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,80 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace songrequests_blazor.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class CorrectedUserVotesRelation : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropForeignKey(
|
|
||||||
name: "FK_AspNetUsers_QueuedSongs_QueuedSongId",
|
|
||||||
table: "AspNetUsers");
|
|
||||||
|
|
||||||
migrationBuilder.DropIndex(
|
|
||||||
name: "IX_AspNetUsers_QueuedSongId",
|
|
||||||
table: "AspNetUsers");
|
|
||||||
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "QueuedSongId",
|
|
||||||
table: "AspNetUsers");
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "QueuedSongUser",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
VotedSongsId = table.Column<int>(type: "INTEGER", nullable: false),
|
|
||||||
VotesId = table.Column<string>(type: "TEXT", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_QueuedSongUser", x => new { x.VotedSongsId, x.VotesId });
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_QueuedSongUser_AspNetUsers_VotesId",
|
|
||||||
column: x => x.VotesId,
|
|
||||||
principalTable: "AspNetUsers",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_QueuedSongUser_QueuedSongs_VotedSongsId",
|
|
||||||
column: x => x.VotedSongsId,
|
|
||||||
principalTable: "QueuedSongs",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_QueuedSongUser_VotesId",
|
|
||||||
table: "QueuedSongUser",
|
|
||||||
column: "VotesId");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "QueuedSongUser");
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<int>(
|
|
||||||
name: "QueuedSongId",
|
|
||||||
table: "AspNetUsers",
|
|
||||||
type: "INTEGER",
|
|
||||||
nullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_AspNetUsers_QueuedSongId",
|
|
||||||
table: "AspNetUsers",
|
|
||||||
column: "QueuedSongId");
|
|
||||||
|
|
||||||
migrationBuilder.AddForeignKey(
|
|
||||||
name: "FK_AspNetUsers_QueuedSongs_QueuedSongId",
|
|
||||||
table: "AspNetUsers",
|
|
||||||
column: "QueuedSongId",
|
|
||||||
principalTable: "QueuedSongs",
|
|
||||||
principalColumn: "Id");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -11,8 +11,8 @@ using songrequests_blazor.Data;
|
|||||||
namespace songrequests_blazor.Migrations
|
namespace songrequests_blazor.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(LocalDbContext))]
|
[DbContext(typeof(LocalDbContext))]
|
||||||
[Migration("20240523183306_CorrectedUserVotesRelation")]
|
[Migration("20240525181342_AddQueueDataAndAdminUser")]
|
||||||
partial class CorrectedUserVotesRelation
|
partial class AddQueueDataAndAdminUser
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
@ -44,6 +44,14 @@ namespace songrequests_blazor.Migrations
|
|||||||
.HasDatabaseName("RoleNameIndex");
|
.HasDatabaseName("RoleNameIndex");
|
||||||
|
|
||||||
b.ToTable("AspNetRoles", (string)null);
|
b.ToTable("AspNetRoles", (string)null);
|
||||||
|
|
||||||
|
b.HasData(
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = "fc985a25-19ce-48ed-8443-c845f550960a",
|
||||||
|
Name = "Administrator",
|
||||||
|
NormalizedName = "ADMINISTRATOR"
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
||||||
@ -140,6 +148,24 @@ namespace songrequests_blazor.Migrations
|
|||||||
b.HasDiscriminator<string>("Discriminator").HasValue("IdentityUser");
|
b.HasDiscriminator<string>("Discriminator").HasValue("IdentityUser");
|
||||||
|
|
||||||
b.UseTphMappingStrategy();
|
b.UseTphMappingStrategy();
|
||||||
|
|
||||||
|
b.HasData(
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = "5c2511d0-6a08-4950-babd-d107996749ba",
|
||||||
|
AccessFailedCount = 0,
|
||||||
|
ConcurrencyStamp = "828466b4-e932-48c2-9ac5-2d5a16bbbade",
|
||||||
|
Email = "admin@admin.com",
|
||||||
|
EmailConfirmed = false,
|
||||||
|
LockoutEnabled = false,
|
||||||
|
NormalizedEmail = "ADMIN@ADMIN.COM",
|
||||||
|
NormalizedUserName = "ADMIN@ADMIN.COM",
|
||||||
|
PasswordHash = "AQAAAAIAAYagAAAAEAHO/Ra7WSxWtOXx++pYevyMsD+Wt/8tsCfJtQ59NaWFxF7BztGzvgNrnblXuYOkww==",
|
||||||
|
PhoneNumberConfirmed = false,
|
||||||
|
SecurityStamp = "23975ce5-b515-4a6a-a6b7-2a5e6d8c943e",
|
||||||
|
TwoFactorEnabled = false,
|
||||||
|
UserName = "admin@admin.com"
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
||||||
@ -200,6 +226,13 @@ namespace songrequests_blazor.Migrations
|
|||||||
b.HasIndex("RoleId");
|
b.HasIndex("RoleId");
|
||||||
|
|
||||||
b.ToTable("AspNetUserRoles", (string)null);
|
b.ToTable("AspNetUserRoles", (string)null);
|
||||||
|
|
||||||
|
b.HasData(
|
||||||
|
new
|
||||||
|
{
|
||||||
|
UserId = "5c2511d0-6a08-4950-babd-d107996749ba",
|
||||||
|
RoleId = "fc985a25-19ce-48ed-8443-c845f550960a"
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
||||||
@ -221,19 +254,52 @@ namespace songrequests_blazor.Migrations
|
|||||||
b.ToTable("AspNetUserTokens", (string)null);
|
b.ToTable("AspNetUserTokens", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("QueuedSongUser", b =>
|
modelBuilder.Entity("QueuedSongs_UserVotes", b =>
|
||||||
{
|
{
|
||||||
|
b.Property<string>("UserVotesId")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.Property<int>("VotedSongsId")
|
b.Property<int>("VotedSongsId")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.Property<string>("VotesId")
|
b.HasKey("UserVotesId", "VotedSongsId");
|
||||||
|
|
||||||
|
b.HasIndex("VotedSongsId");
|
||||||
|
|
||||||
|
b.ToTable("QueuedSongs_UserVotes");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Sessions_Libraries", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("EnabledLibrariesId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("UsedInSessionsId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.HasKey("EnabledLibrariesId", "UsedInSessionsId");
|
||||||
|
|
||||||
|
b.HasIndex("UsedInSessionsId");
|
||||||
|
|
||||||
|
b.ToTable("Sessions_Libraries");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("songrequests_blazor.Data.Library", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.HasKey("VotedSongsId", "VotesId");
|
b.Property<int>("Type")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.HasIndex("VotesId");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.ToTable("QueuedSongUser");
|
b.ToTable("Libraries");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("songrequests_blazor.Data.QueuedSong", b =>
|
modelBuilder.Entity("songrequests_blazor.Data.QueuedSong", b =>
|
||||||
@ -245,23 +311,28 @@ namespace songrequests_blazor.Migrations
|
|||||||
b.Property<DateTime>("Added")
|
b.Property<DateTime>("Added")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.Property<DateTime>("Played")
|
b.Property<string>("AddedBy_User_ID")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("Played")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.Property<int>("Position")
|
b.Property<int>("Position")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.Property<int?>("SessionId")
|
b.Property<int>("Session_ID")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.Property<int>("SongId")
|
b.Property<int>("Song_ID")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.HasIndex("SessionId");
|
b.HasIndex("AddedBy_User_ID");
|
||||||
|
|
||||||
b.HasIndex("SongId");
|
b.HasIndex("Session_ID");
|
||||||
|
|
||||||
|
b.HasIndex("Song_ID");
|
||||||
|
|
||||||
b.ToTable("QueuedSongs");
|
b.ToTable("QueuedSongs");
|
||||||
});
|
});
|
||||||
@ -301,17 +372,17 @@ namespace songrequests_blazor.Migrations
|
|||||||
b.Property<TimeSpan>("Length")
|
b.Property<TimeSpan>("Length")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("Library_ID")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.Property<int>("RequestCount")
|
b.Property<int>("RequestCount")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.Property<int>("Source")
|
b.Property<string>("Title")
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<string>("SourceUri")
|
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.Property<string>("Title")
|
b.Property<string>("Uri")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
@ -320,6 +391,8 @@ namespace songrequests_blazor.Migrations
|
|||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("Library_ID");
|
||||||
|
|
||||||
b.ToTable("Songs");
|
b.ToTable("Songs");
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -381,39 +454,94 @@ namespace songrequests_blazor.Migrations
|
|||||||
.IsRequired();
|
.IsRequired();
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("QueuedSongUser", b =>
|
modelBuilder.Entity("QueuedSongs_UserVotes", b =>
|
||||||
{
|
{
|
||||||
|
b.HasOne("songrequests_blazor.Data.User", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UserVotesId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
b.HasOne("songrequests_blazor.Data.QueuedSong", null)
|
b.HasOne("songrequests_blazor.Data.QueuedSong", null)
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("VotedSongsId")
|
.HasForeignKey("VotedSongsId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
b.HasOne("songrequests_blazor.Data.User", null)
|
modelBuilder.Entity("Sessions_Libraries", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("songrequests_blazor.Data.Library", null)
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("VotesId")
|
.HasForeignKey("EnabledLibrariesId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("songrequests_blazor.Data.Session", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UsedInSessionsId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("songrequests_blazor.Data.QueuedSong", b =>
|
modelBuilder.Entity("songrequests_blazor.Data.QueuedSong", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("songrequests_blazor.Data.Session", null)
|
b.HasOne("songrequests_blazor.Data.User", "AdddedBy")
|
||||||
.WithMany("Queue")
|
.WithMany("AddedSongs")
|
||||||
.HasForeignKey("SessionId");
|
.HasForeignKey("AddedBy_User_ID")
|
||||||
|
.HasConstraintName("FK_user_addedsongs");
|
||||||
|
|
||||||
|
b.HasOne("songrequests_blazor.Data.Session", "Session")
|
||||||
|
.WithMany("QueuedSongs")
|
||||||
|
.HasForeignKey("Session_ID")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired()
|
||||||
|
.HasConstraintName("FK_Session_QueuedSongs");
|
||||||
|
|
||||||
b.HasOne("songrequests_blazor.Data.Song", "Song")
|
b.HasOne("songrequests_blazor.Data.Song", "Song")
|
||||||
.WithMany()
|
.WithMany("Queued")
|
||||||
.HasForeignKey("SongId")
|
.HasForeignKey("Song_ID")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired()
|
||||||
|
.HasConstraintName("FK_queuedsongs_song");
|
||||||
|
|
||||||
|
b.Navigation("AdddedBy");
|
||||||
|
|
||||||
|
b.Navigation("Session");
|
||||||
|
|
||||||
b.Navigation("Song");
|
b.Navigation("Song");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("songrequests_blazor.Data.Song", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("songrequests_blazor.Data.Library", "Library")
|
||||||
|
.WithMany("Songs")
|
||||||
|
.HasForeignKey("Library_ID")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired()
|
||||||
|
.HasConstraintName("FK_library_songs");
|
||||||
|
|
||||||
|
b.Navigation("Library");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("songrequests_blazor.Data.Library", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Songs");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("songrequests_blazor.Data.Session", b =>
|
modelBuilder.Entity("songrequests_blazor.Data.Session", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("Queue");
|
b.Navigation("QueuedSongs");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("songrequests_blazor.Data.Song", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Queued");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("songrequests_blazor.Data.User", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("AddedSongs");
|
||||||
});
|
});
|
||||||
#pragma warning restore 612, 618
|
#pragma warning restore 612, 618
|
||||||
}
|
}
|
||||||
@ -0,0 +1,264 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace songrequests_blazor.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class AddQueueDataAndAdminUser : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "SourceUri",
|
||||||
|
table: "Songs",
|
||||||
|
newName: "Uri");
|
||||||
|
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "Source",
|
||||||
|
table: "Songs",
|
||||||
|
newName: "RequestCount");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "Library_ID",
|
||||||
|
table: "Songs",
|
||||||
|
type: "INTEGER",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "Discriminator",
|
||||||
|
table: "AspNetUsers",
|
||||||
|
type: "TEXT",
|
||||||
|
maxLength: 13,
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: "");
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Libraries",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||||
|
.Annotation("Sqlite:Autoincrement", true),
|
||||||
|
Name = table.Column<string>(type: "TEXT", nullable: false),
|
||||||
|
Type = table.Column<int>(type: "INTEGER", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Libraries", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Sessions",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||||
|
.Annotation("Sqlite:Autoincrement", true),
|
||||||
|
SessionCode = table.Column<string>(type: "TEXT", nullable: true),
|
||||||
|
Created = table.Column<DateTime>(type: "TEXT", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Sessions", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "QueuedSongs",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||||
|
.Annotation("Sqlite:Autoincrement", true),
|
||||||
|
Position = table.Column<int>(type: "INTEGER", nullable: false),
|
||||||
|
Song_ID = table.Column<int>(type: "INTEGER", nullable: false),
|
||||||
|
AddedBy_User_ID = table.Column<string>(type: "TEXT", nullable: true),
|
||||||
|
Added = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||||
|
Played = table.Column<DateTime>(type: "TEXT", nullable: true),
|
||||||
|
Session_ID = table.Column<int>(type: "INTEGER", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_QueuedSongs", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Session_QueuedSongs",
|
||||||
|
column: x => x.Session_ID,
|
||||||
|
principalTable: "Sessions",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_queuedsongs_song",
|
||||||
|
column: x => x.Song_ID,
|
||||||
|
principalTable: "Songs",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_user_addedsongs",
|
||||||
|
column: x => x.AddedBy_User_ID,
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id");
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Sessions_Libraries",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
EnabledLibrariesId = table.Column<int>(type: "INTEGER", nullable: false),
|
||||||
|
UsedInSessionsId = table.Column<int>(type: "INTEGER", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Sessions_Libraries", x => new { x.EnabledLibrariesId, x.UsedInSessionsId });
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Sessions_Libraries_Libraries_EnabledLibrariesId",
|
||||||
|
column: x => x.EnabledLibrariesId,
|
||||||
|
principalTable: "Libraries",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Sessions_Libraries_Sessions_UsedInSessionsId",
|
||||||
|
column: x => x.UsedInSessionsId,
|
||||||
|
principalTable: "Sessions",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "QueuedSongs_UserVotes",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
UserVotesId = table.Column<string>(type: "TEXT", nullable: false),
|
||||||
|
VotedSongsId = table.Column<int>(type: "INTEGER", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_QueuedSongs_UserVotes", x => new { x.UserVotesId, x.VotedSongsId });
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_QueuedSongs_UserVotes_AspNetUsers_UserVotesId",
|
||||||
|
column: x => x.UserVotesId,
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_QueuedSongs_UserVotes_QueuedSongs_VotedSongsId",
|
||||||
|
column: x => x.VotedSongsId,
|
||||||
|
principalTable: "QueuedSongs",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.InsertData(
|
||||||
|
table: "AspNetRoles",
|
||||||
|
columns: new[] { "Id", "ConcurrencyStamp", "Name", "NormalizedName" },
|
||||||
|
values: new object[] { "fc985a25-19ce-48ed-8443-c845f550960a", null, "Administrator", "ADMINISTRATOR" });
|
||||||
|
|
||||||
|
migrationBuilder.InsertData(
|
||||||
|
table: "AspNetUsers",
|
||||||
|
columns: new[] { "Id", "AccessFailedCount", "ConcurrencyStamp", "Discriminator", "Email", "EmailConfirmed", "LockoutEnabled", "LockoutEnd", "NormalizedEmail", "NormalizedUserName", "PasswordHash", "PhoneNumber", "PhoneNumberConfirmed", "SecurityStamp", "TwoFactorEnabled", "UserName" },
|
||||||
|
values: new object[] { "5c2511d0-6a08-4950-babd-d107996749ba", 0, "828466b4-e932-48c2-9ac5-2d5a16bbbade", "IdentityUser", "admin@admin.com", false, false, null, "ADMIN@ADMIN.COM", "ADMIN@ADMIN.COM", "AQAAAAIAAYagAAAAEAHO/Ra7WSxWtOXx++pYevyMsD+Wt/8tsCfJtQ59NaWFxF7BztGzvgNrnblXuYOkww==", null, false, "23975ce5-b515-4a6a-a6b7-2a5e6d8c943e", false, "admin@admin.com" });
|
||||||
|
|
||||||
|
migrationBuilder.InsertData(
|
||||||
|
table: "AspNetUserRoles",
|
||||||
|
columns: new[] { "RoleId", "UserId" },
|
||||||
|
values: new object[] { "fc985a25-19ce-48ed-8443-c845f550960a", "5c2511d0-6a08-4950-babd-d107996749ba" });
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Songs_Library_ID",
|
||||||
|
table: "Songs",
|
||||||
|
column: "Library_ID");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_QueuedSongs_AddedBy_User_ID",
|
||||||
|
table: "QueuedSongs",
|
||||||
|
column: "AddedBy_User_ID");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_QueuedSongs_Session_ID",
|
||||||
|
table: "QueuedSongs",
|
||||||
|
column: "Session_ID");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_QueuedSongs_Song_ID",
|
||||||
|
table: "QueuedSongs",
|
||||||
|
column: "Song_ID");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_QueuedSongs_UserVotes_VotedSongsId",
|
||||||
|
table: "QueuedSongs_UserVotes",
|
||||||
|
column: "VotedSongsId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Sessions_Libraries_UsedInSessionsId",
|
||||||
|
table: "Sessions_Libraries",
|
||||||
|
column: "UsedInSessionsId");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_library_songs",
|
||||||
|
table: "Songs",
|
||||||
|
column: "Library_ID",
|
||||||
|
principalTable: "Libraries",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_library_songs",
|
||||||
|
table: "Songs");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "QueuedSongs_UserVotes");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Sessions_Libraries");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "QueuedSongs");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Libraries");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Sessions");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_Songs_Library_ID",
|
||||||
|
table: "Songs");
|
||||||
|
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "AspNetUserRoles",
|
||||||
|
keyColumns: new[] { "RoleId", "UserId" },
|
||||||
|
keyValues: new object[] { "fc985a25-19ce-48ed-8443-c845f550960a", "5c2511d0-6a08-4950-babd-d107996749ba" });
|
||||||
|
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "AspNetRoles",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: "fc985a25-19ce-48ed-8443-c845f550960a");
|
||||||
|
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "AspNetUsers",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: "5c2511d0-6a08-4950-babd-d107996749ba");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Library_ID",
|
||||||
|
table: "Songs");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Discriminator",
|
||||||
|
table: "AspNetUsers");
|
||||||
|
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "Uri",
|
||||||
|
table: "Songs",
|
||||||
|
newName: "SourceUri");
|
||||||
|
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "RequestCount",
|
||||||
|
table: "Songs",
|
||||||
|
newName: "Source");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -41,6 +41,14 @@ namespace songrequests_blazor.Migrations
|
|||||||
.HasDatabaseName("RoleNameIndex");
|
.HasDatabaseName("RoleNameIndex");
|
||||||
|
|
||||||
b.ToTable("AspNetRoles", (string)null);
|
b.ToTable("AspNetRoles", (string)null);
|
||||||
|
|
||||||
|
b.HasData(
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = "fc985a25-19ce-48ed-8443-c845f550960a",
|
||||||
|
Name = "Administrator",
|
||||||
|
NormalizedName = "ADMINISTRATOR"
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
||||||
@ -137,6 +145,24 @@ namespace songrequests_blazor.Migrations
|
|||||||
b.HasDiscriminator<string>("Discriminator").HasValue("IdentityUser");
|
b.HasDiscriminator<string>("Discriminator").HasValue("IdentityUser");
|
||||||
|
|
||||||
b.UseTphMappingStrategy();
|
b.UseTphMappingStrategy();
|
||||||
|
|
||||||
|
b.HasData(
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = "5c2511d0-6a08-4950-babd-d107996749ba",
|
||||||
|
AccessFailedCount = 0,
|
||||||
|
ConcurrencyStamp = "828466b4-e932-48c2-9ac5-2d5a16bbbade",
|
||||||
|
Email = "admin@admin.com",
|
||||||
|
EmailConfirmed = false,
|
||||||
|
LockoutEnabled = false,
|
||||||
|
NormalizedEmail = "ADMIN@ADMIN.COM",
|
||||||
|
NormalizedUserName = "ADMIN@ADMIN.COM",
|
||||||
|
PasswordHash = "AQAAAAIAAYagAAAAEAHO/Ra7WSxWtOXx++pYevyMsD+Wt/8tsCfJtQ59NaWFxF7BztGzvgNrnblXuYOkww==",
|
||||||
|
PhoneNumberConfirmed = false,
|
||||||
|
SecurityStamp = "23975ce5-b515-4a6a-a6b7-2a5e6d8c943e",
|
||||||
|
TwoFactorEnabled = false,
|
||||||
|
UserName = "admin@admin.com"
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
||||||
@ -197,6 +223,13 @@ namespace songrequests_blazor.Migrations
|
|||||||
b.HasIndex("RoleId");
|
b.HasIndex("RoleId");
|
||||||
|
|
||||||
b.ToTable("AspNetUserRoles", (string)null);
|
b.ToTable("AspNetUserRoles", (string)null);
|
||||||
|
|
||||||
|
b.HasData(
|
||||||
|
new
|
||||||
|
{
|
||||||
|
UserId = "5c2511d0-6a08-4950-babd-d107996749ba",
|
||||||
|
RoleId = "fc985a25-19ce-48ed-8443-c845f550960a"
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
||||||
@ -218,19 +251,52 @@ namespace songrequests_blazor.Migrations
|
|||||||
b.ToTable("AspNetUserTokens", (string)null);
|
b.ToTable("AspNetUserTokens", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("QueuedSongUser", b =>
|
modelBuilder.Entity("QueuedSongs_UserVotes", b =>
|
||||||
{
|
{
|
||||||
|
b.Property<string>("UserVotesId")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.Property<int>("VotedSongsId")
|
b.Property<int>("VotedSongsId")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.Property<string>("VotesId")
|
b.HasKey("UserVotesId", "VotedSongsId");
|
||||||
|
|
||||||
|
b.HasIndex("VotedSongsId");
|
||||||
|
|
||||||
|
b.ToTable("QueuedSongs_UserVotes");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Sessions_Libraries", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("EnabledLibrariesId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("UsedInSessionsId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.HasKey("EnabledLibrariesId", "UsedInSessionsId");
|
||||||
|
|
||||||
|
b.HasIndex("UsedInSessionsId");
|
||||||
|
|
||||||
|
b.ToTable("Sessions_Libraries");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("songrequests_blazor.Data.Library", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.HasKey("VotedSongsId", "VotesId");
|
b.Property<int>("Type")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.HasIndex("VotesId");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.ToTable("QueuedSongUser");
|
b.ToTable("Libraries");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("songrequests_blazor.Data.QueuedSong", b =>
|
modelBuilder.Entity("songrequests_blazor.Data.QueuedSong", b =>
|
||||||
@ -242,23 +308,28 @@ namespace songrequests_blazor.Migrations
|
|||||||
b.Property<DateTime>("Added")
|
b.Property<DateTime>("Added")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.Property<DateTime>("Played")
|
b.Property<string>("AddedBy_User_ID")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("Played")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.Property<int>("Position")
|
b.Property<int>("Position")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.Property<int?>("SessionId")
|
b.Property<int>("Session_ID")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.Property<int>("SongId")
|
b.Property<int>("Song_ID")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.HasIndex("SessionId");
|
b.HasIndex("AddedBy_User_ID");
|
||||||
|
|
||||||
b.HasIndex("SongId");
|
b.HasIndex("Session_ID");
|
||||||
|
|
||||||
|
b.HasIndex("Song_ID");
|
||||||
|
|
||||||
b.ToTable("QueuedSongs");
|
b.ToTable("QueuedSongs");
|
||||||
});
|
});
|
||||||
@ -298,17 +369,17 @@ namespace songrequests_blazor.Migrations
|
|||||||
b.Property<TimeSpan>("Length")
|
b.Property<TimeSpan>("Length")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("Library_ID")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.Property<int>("RequestCount")
|
b.Property<int>("RequestCount")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.Property<int>("Source")
|
b.Property<string>("Title")
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<string>("SourceUri")
|
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.Property<string>("Title")
|
b.Property<string>("Uri")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
@ -317,6 +388,8 @@ namespace songrequests_blazor.Migrations
|
|||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("Library_ID");
|
||||||
|
|
||||||
b.ToTable("Songs");
|
b.ToTable("Songs");
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -378,39 +451,94 @@ namespace songrequests_blazor.Migrations
|
|||||||
.IsRequired();
|
.IsRequired();
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("QueuedSongUser", b =>
|
modelBuilder.Entity("QueuedSongs_UserVotes", b =>
|
||||||
{
|
{
|
||||||
|
b.HasOne("songrequests_blazor.Data.User", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UserVotesId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
b.HasOne("songrequests_blazor.Data.QueuedSong", null)
|
b.HasOne("songrequests_blazor.Data.QueuedSong", null)
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("VotedSongsId")
|
.HasForeignKey("VotedSongsId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
b.HasOne("songrequests_blazor.Data.User", null)
|
modelBuilder.Entity("Sessions_Libraries", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("songrequests_blazor.Data.Library", null)
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("VotesId")
|
.HasForeignKey("EnabledLibrariesId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("songrequests_blazor.Data.Session", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UsedInSessionsId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("songrequests_blazor.Data.QueuedSong", b =>
|
modelBuilder.Entity("songrequests_blazor.Data.QueuedSong", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("songrequests_blazor.Data.Session", null)
|
b.HasOne("songrequests_blazor.Data.User", "AdddedBy")
|
||||||
.WithMany("Queue")
|
.WithMany("AddedSongs")
|
||||||
.HasForeignKey("SessionId");
|
.HasForeignKey("AddedBy_User_ID")
|
||||||
|
.HasConstraintName("FK_user_addedsongs");
|
||||||
|
|
||||||
|
b.HasOne("songrequests_blazor.Data.Session", "Session")
|
||||||
|
.WithMany("QueuedSongs")
|
||||||
|
.HasForeignKey("Session_ID")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired()
|
||||||
|
.HasConstraintName("FK_Session_QueuedSongs");
|
||||||
|
|
||||||
b.HasOne("songrequests_blazor.Data.Song", "Song")
|
b.HasOne("songrequests_blazor.Data.Song", "Song")
|
||||||
.WithMany()
|
.WithMany("Queued")
|
||||||
.HasForeignKey("SongId")
|
.HasForeignKey("Song_ID")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired()
|
||||||
|
.HasConstraintName("FK_queuedsongs_song");
|
||||||
|
|
||||||
|
b.Navigation("AdddedBy");
|
||||||
|
|
||||||
|
b.Navigation("Session");
|
||||||
|
|
||||||
b.Navigation("Song");
|
b.Navigation("Song");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("songrequests_blazor.Data.Song", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("songrequests_blazor.Data.Library", "Library")
|
||||||
|
.WithMany("Songs")
|
||||||
|
.HasForeignKey("Library_ID")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired()
|
||||||
|
.HasConstraintName("FK_library_songs");
|
||||||
|
|
||||||
|
b.Navigation("Library");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("songrequests_blazor.Data.Library", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Songs");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("songrequests_blazor.Data.Session", b =>
|
modelBuilder.Entity("songrequests_blazor.Data.Session", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("Queue");
|
b.Navigation("QueuedSongs");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("songrequests_blazor.Data.Song", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Queued");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("songrequests_blazor.Data.User", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("AddedSongs");
|
||||||
});
|
});
|
||||||
#pragma warning restore 612, 618
|
#pragma warning restore 612, 618
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
BIN
songrequests_blazor/data.db-shm
Normal file
BIN
songrequests_blazor/data.db-shm
Normal file
Binary file not shown.
0
songrequests_blazor/data.db-wal
Normal file
0
songrequests_blazor/data.db-wal
Normal file
Loading…
x
Reference in New Issue
Block a user