new tables
This commit is contained in:
@@ -0,0 +1,10 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"Id": 1,
|
||||||
|
"Name": "Male"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Id": 2,
|
||||||
|
"Name": "Female"
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -9,7 +9,9 @@ using System.Diagnostics.CodeAnalysis;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using WatchIt.Database.Model.Common;
|
||||||
using WatchIt.Database.Model.Media;
|
using WatchIt.Database.Model.Media;
|
||||||
|
using WatchIt.Database.Model.Rating;
|
||||||
|
|
||||||
namespace WatchIt.Database.Model.Account
|
namespace WatchIt.Database.Model.Account
|
||||||
{
|
{
|
||||||
@@ -21,6 +23,7 @@ namespace WatchIt.Database.Model.Account
|
|||||||
public string Username { get; set; }
|
public string Username { get; set; }
|
||||||
public string Email { get; set; }
|
public string Email { get; set; }
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
|
public short GenderId { get; set; }
|
||||||
public Guid? ProfilePictureId { get; set; }
|
public Guid? ProfilePictureId { get; set; }
|
||||||
public Guid? BackgroundPictureId { get; set; }
|
public Guid? BackgroundPictureId { get; set; }
|
||||||
public byte[] Password { get; set; }
|
public byte[] Password { get; set; }
|
||||||
@@ -36,9 +39,16 @@ namespace WatchIt.Database.Model.Account
|
|||||||
|
|
||||||
#region NAVIGATION
|
#region NAVIGATION
|
||||||
|
|
||||||
|
public Gender Gender { get; set; }
|
||||||
public AccountProfilePicture? ProfilePicture { get; set; }
|
public AccountProfilePicture? ProfilePicture { get; set; }
|
||||||
public MediaPhotoImage? BackgroundPicture { get; set; }
|
public MediaPhotoImage? BackgroundPicture { get; set; }
|
||||||
|
|
||||||
|
public IEnumerable<RatingMedia> RatingMedia { get; set; }
|
||||||
|
public IEnumerable<RatingPersonActorRole> RatingPersonActorRole { get; set; }
|
||||||
|
public IEnumerable<RatingPersonCreatorRole> RatingPersonCreatorRole { get; set; }
|
||||||
|
public IEnumerable<RatingMediaSeriesSeason> RatingMediaSeriesSeason { get; set; }
|
||||||
|
public IEnumerable<RatingMediaSeriesEpisode> RatingMediaSeriesEpisode { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
@@ -64,6 +74,13 @@ namespace WatchIt.Database.Model.Account
|
|||||||
builder.Property(x => x.Description)
|
builder.Property(x => x.Description)
|
||||||
.HasMaxLength(1000);
|
.HasMaxLength(1000);
|
||||||
|
|
||||||
|
builder.HasOne(x => x.Gender)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey(x => x.GenderId)
|
||||||
|
.IsRequired();
|
||||||
|
builder.Property(x => x.GenderId)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
builder.HasOne(x => x.ProfilePicture)
|
builder.HasOne(x => x.ProfilePicture)
|
||||||
.WithOne(x => x.Account)
|
.WithOne(x => x.Account)
|
||||||
.HasForeignKey<Account>(e => e.ProfilePictureId);
|
.HasForeignKey<Account>(e => e.ProfilePictureId);
|
||||||
|
|||||||
41
WatchIt.Database/WatchIt.Database.Model/Common/Gender.cs
Normal file
41
WatchIt.Database/WatchIt.Database.Model/Common/Gender.cs
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using WatchIt.Database.DataSeeding;
|
||||||
|
using WatchIt.Database.Model.Person;
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Model.Common
|
||||||
|
{
|
||||||
|
public class Gender : IEntity<Gender>
|
||||||
|
{
|
||||||
|
#region PROPERTIES
|
||||||
|
|
||||||
|
public short Id { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region PUBLIC METHODS
|
||||||
|
|
||||||
|
static void IEntity<Gender>.Build(EntityTypeBuilder<Gender> builder)
|
||||||
|
{
|
||||||
|
builder.HasKey(x => x.Id);
|
||||||
|
builder.HasIndex(x => x.Id)
|
||||||
|
.IsUnique();
|
||||||
|
builder.Property(x => x.Id)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.Name)
|
||||||
|
.IsRequired();
|
||||||
|
}
|
||||||
|
|
||||||
|
static IEnumerable<Gender> IEntity<Gender>.InsertData() => DataReader.Read<Gender>();
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,6 +7,8 @@ using System.Threading.Tasks;
|
|||||||
using WatchIt.Database.Model.Account;
|
using WatchIt.Database.Model.Account;
|
||||||
using WatchIt.Database.Model.Common;
|
using WatchIt.Database.Model.Common;
|
||||||
using WatchIt.Database.Model.Person;
|
using WatchIt.Database.Model.Person;
|
||||||
|
using WatchIt.Database.Model.Rating;
|
||||||
|
using WatchIt.Database.Model.ViewCount;
|
||||||
|
|
||||||
namespace WatchIt.Database.Model.Media
|
namespace WatchIt.Database.Model.Media
|
||||||
{
|
{
|
||||||
@@ -42,6 +44,10 @@ namespace WatchIt.Database.Model.Media
|
|||||||
|
|
||||||
public IEnumerable<PersonCreatorRole> PersonCreatorRoles { get; set; }
|
public IEnumerable<PersonCreatorRole> PersonCreatorRoles { get; set; }
|
||||||
|
|
||||||
|
public IEnumerable<RatingMedia> RatingMedia { get; set; }
|
||||||
|
|
||||||
|
public IEnumerable<ViewCountMedia> ViewCountsMedia { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using WatchIt.Database.Model.Rating;
|
||||||
|
|
||||||
namespace WatchIt.Database.Model.Media
|
namespace WatchIt.Database.Model.Media
|
||||||
{
|
{
|
||||||
@@ -25,6 +26,7 @@ namespace WatchIt.Database.Model.Media
|
|||||||
#region NAVIGATION
|
#region NAVIGATION
|
||||||
|
|
||||||
public MediaSeriesSeason MediaSeriesSeason { get; set; }
|
public MediaSeriesSeason MediaSeriesSeason { get; set; }
|
||||||
|
public IEnumerable<RatingMediaSeriesEpisode> RatingMediaSeriesEpisode { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using WatchIt.Database.Model.Rating;
|
||||||
|
|
||||||
namespace WatchIt.Database.Model.Media
|
namespace WatchIt.Database.Model.Media
|
||||||
{
|
{
|
||||||
@@ -25,6 +26,7 @@ namespace WatchIt.Database.Model.Media
|
|||||||
|
|
||||||
public MediaSeries MediaSeries { get; set; }
|
public MediaSeries MediaSeries { get; set; }
|
||||||
public IEnumerable<MediaSeriesEpisode> MediaSeriesEpisodes { get; set; }
|
public IEnumerable<MediaSeriesEpisode> MediaSeriesEpisodes { get; set; }
|
||||||
|
public IEnumerable<RatingMediaSeriesSeason> RatingMediaSeriesSeason { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using WatchIt.Database.Model.Account;
|
using WatchIt.Database.Model.Account;
|
||||||
|
using WatchIt.Database.Model.Common;
|
||||||
|
using WatchIt.Database.Model.ViewCount;
|
||||||
|
|
||||||
namespace WatchIt.Database.Model.Person
|
namespace WatchIt.Database.Model.Person
|
||||||
{
|
{
|
||||||
@@ -18,6 +20,7 @@ namespace WatchIt.Database.Model.Person
|
|||||||
public string? Description { get; set; }
|
public string? Description { get; set; }
|
||||||
public DateOnly? BirthDate { get; set; }
|
public DateOnly? BirthDate { get; set; }
|
||||||
public DateOnly? DeathDate { get; set; }
|
public DateOnly? DeathDate { get; set; }
|
||||||
|
public short GenderId { get; set; }
|
||||||
public Guid? PersonPhotoId { get; set; }
|
public Guid? PersonPhotoId { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -26,9 +29,11 @@ namespace WatchIt.Database.Model.Person
|
|||||||
|
|
||||||
#region NAVIGATION
|
#region NAVIGATION
|
||||||
|
|
||||||
|
public Gender Gender { get; set; }
|
||||||
public PersonPhotoImage? PersonPhoto { get; set; }
|
public PersonPhotoImage? PersonPhoto { get; set; }
|
||||||
public IEnumerable<PersonActorRole> PersonActorRoles { get; set; }
|
public IEnumerable<PersonActorRole> PersonActorRoles { get; set; }
|
||||||
public IEnumerable<PersonCreatorRole> PersonCreatorRoles { get; set; }
|
public IEnumerable<PersonCreatorRole> PersonCreatorRoles { get; set; }
|
||||||
|
public IEnumerable<ViewCountPerson> ViewCountsPerson { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -58,6 +63,13 @@ namespace WatchIt.Database.Model.Person
|
|||||||
|
|
||||||
builder.Property(x => x.DeathDate);
|
builder.Property(x => x.DeathDate);
|
||||||
|
|
||||||
|
builder.HasOne(x => x.Gender)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey(x => x.GenderId)
|
||||||
|
.IsRequired();
|
||||||
|
builder.Property(x => x.GenderId)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
builder.HasOne(x => x.PersonPhoto)
|
builder.HasOne(x => x.PersonPhoto)
|
||||||
.WithOne(x => x.Person)
|
.WithOne(x => x.Person)
|
||||||
.HasForeignKey<Person>(e => e.PersonPhotoId);
|
.HasForeignKey<Person>(e => e.PersonPhotoId);
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using WatchIt.Database.Model.Media;
|
using WatchIt.Database.Model.Media;
|
||||||
|
using WatchIt.Database.Model.Rating;
|
||||||
|
|
||||||
namespace WatchIt.Database.Model.Person
|
namespace WatchIt.Database.Model.Person
|
||||||
{
|
{
|
||||||
@@ -28,6 +29,8 @@ namespace WatchIt.Database.Model.Person
|
|||||||
public Media.Media Media { get; set; }
|
public Media.Media Media { get; set; }
|
||||||
public PersonActorRoleType PersonActorRoleType { get; set; }
|
public PersonActorRoleType PersonActorRoleType { get; set; }
|
||||||
|
|
||||||
|
public IEnumerable<RatingPersonActorRole> RatingPersonActorRole { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using WatchIt.Database.Model.Rating;
|
||||||
|
|
||||||
namespace WatchIt.Database.Model.Person
|
namespace WatchIt.Database.Model.Person
|
||||||
{
|
{
|
||||||
@@ -25,6 +26,7 @@ namespace WatchIt.Database.Model.Person
|
|||||||
public Person Person { get; set; }
|
public Person Person { get; set; }
|
||||||
public Media.Media Media { get; set; }
|
public Media.Media Media { get; set; }
|
||||||
public PersonCreatorRoleType PersonCreatorRoleType { get; set; }
|
public PersonCreatorRoleType PersonCreatorRoleType { get; set; }
|
||||||
|
public IEnumerable<RatingPersonCreatorRole> RatingPersonCreatorRole { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Model.Rating
|
||||||
|
{
|
||||||
|
public class RatingMedia : IEntity<RatingMedia>
|
||||||
|
{
|
||||||
|
#region PROPERTIES
|
||||||
|
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
public long MediaId { get; set; }
|
||||||
|
public long AccountId { get; set; }
|
||||||
|
public short Rating { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region NAVIGATION
|
||||||
|
|
||||||
|
public Media.Media Media { get; set; }
|
||||||
|
public Account.Account Account { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region PUBLIC METHODS
|
||||||
|
|
||||||
|
static void IEntity<RatingMedia>.Build(EntityTypeBuilder<RatingMedia> builder)
|
||||||
|
{
|
||||||
|
builder.HasKey(x => x.Id);
|
||||||
|
builder.HasIndex(x => x.Id)
|
||||||
|
.IsUnique();
|
||||||
|
builder.Property(x => x.Id)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.HasOne(x => x.Media)
|
||||||
|
.WithMany(x => x.RatingMedia)
|
||||||
|
.HasForeignKey(x => x.MediaId)
|
||||||
|
.IsRequired();
|
||||||
|
builder.Property(x => x.MediaId)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.HasOne(x => x.Account)
|
||||||
|
.WithMany(x => x.RatingMedia)
|
||||||
|
.HasForeignKey(x => x.AccountId)
|
||||||
|
.IsRequired();
|
||||||
|
builder.Property(x => x.AccountId)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.Rating)
|
||||||
|
.IsRequired();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using WatchIt.Database.Model.Media;
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Model.Rating
|
||||||
|
{
|
||||||
|
public class RatingMediaSeriesEpisode : IEntity<RatingMediaSeriesEpisode>
|
||||||
|
{
|
||||||
|
#region PROPERTIES
|
||||||
|
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
public Guid MediaSeriesEpisodeId { get; set; }
|
||||||
|
public long AccountId { get; set; }
|
||||||
|
public short Rating { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region NAVIGATION
|
||||||
|
|
||||||
|
public MediaSeriesEpisode MediaSeriesEpisode { get; set; }
|
||||||
|
public Account.Account Account { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region PUBLIC METHODS
|
||||||
|
|
||||||
|
static void IEntity<RatingMediaSeriesEpisode>.Build(EntityTypeBuilder<RatingMediaSeriesEpisode> builder)
|
||||||
|
{
|
||||||
|
builder.HasKey(x => x.Id);
|
||||||
|
builder.HasIndex(x => x.Id)
|
||||||
|
.IsUnique();
|
||||||
|
builder.Property(x => x.Id)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.HasOne(x => x.MediaSeriesEpisode)
|
||||||
|
.WithMany(x => x.RatingMediaSeriesEpisode)
|
||||||
|
.HasForeignKey(x => x.MediaSeriesEpisodeId)
|
||||||
|
.IsRequired();
|
||||||
|
builder.Property(x => x.MediaSeriesEpisodeId)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.HasOne(x => x.Account)
|
||||||
|
.WithMany(x => x.RatingMediaSeriesEpisode)
|
||||||
|
.HasForeignKey(x => x.AccountId)
|
||||||
|
.IsRequired();
|
||||||
|
builder.Property(x => x.AccountId)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.Rating)
|
||||||
|
.IsRequired();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using WatchIt.Database.Model.Media;
|
||||||
|
using WatchIt.Database.Model.Person;
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Model.Rating
|
||||||
|
{
|
||||||
|
public class RatingMediaSeriesSeason : IEntity<RatingMediaSeriesSeason>
|
||||||
|
{
|
||||||
|
#region PROPERTIES
|
||||||
|
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
public Guid MediaSeriesSeasonId { get; set; }
|
||||||
|
public long AccountId { get; set; }
|
||||||
|
public short Rating { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region NAVIGATION
|
||||||
|
|
||||||
|
public MediaSeriesSeason MediaSeriesSeason { get; set; }
|
||||||
|
public Account.Account Account { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region PUBLIC METHODS
|
||||||
|
|
||||||
|
static void IEntity<RatingMediaSeriesSeason>.Build(EntityTypeBuilder<RatingMediaSeriesSeason> builder)
|
||||||
|
{
|
||||||
|
builder.HasKey(x => x.Id);
|
||||||
|
builder.HasIndex(x => x.Id)
|
||||||
|
.IsUnique();
|
||||||
|
builder.Property(x => x.Id)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.HasOne(x => x.MediaSeriesSeason)
|
||||||
|
.WithMany(x => x.RatingMediaSeriesSeason)
|
||||||
|
.HasForeignKey(x => x.MediaSeriesSeasonId)
|
||||||
|
.IsRequired();
|
||||||
|
builder.Property(x => x.MediaSeriesSeasonId)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.HasOne(x => x.Account)
|
||||||
|
.WithMany(x => x.RatingMediaSeriesSeason)
|
||||||
|
.HasForeignKey(x => x.AccountId)
|
||||||
|
.IsRequired();
|
||||||
|
builder.Property(x => x.AccountId)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.Rating)
|
||||||
|
.IsRequired();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using WatchIt.Database.Model.Person;
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Model.Rating
|
||||||
|
{
|
||||||
|
public class RatingPersonActorRole : IEntity<RatingPersonActorRole>
|
||||||
|
{
|
||||||
|
#region PROPERTIES
|
||||||
|
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
public Guid PersonActorRoleId { get; set; }
|
||||||
|
public long AccountId { get; set; }
|
||||||
|
public short Rating { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region NAVIGATION
|
||||||
|
|
||||||
|
public PersonActorRole PersonActorRole { get; set; }
|
||||||
|
public Account.Account Account { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region PUBLIC METHODS
|
||||||
|
|
||||||
|
static void IEntity<RatingPersonActorRole>.Build(EntityTypeBuilder<RatingPersonActorRole> builder)
|
||||||
|
{
|
||||||
|
builder.ToTable("RatingsPersonActorRole");
|
||||||
|
|
||||||
|
builder.HasKey(x => x.Id);
|
||||||
|
builder.HasIndex(x => x.Id)
|
||||||
|
.IsUnique();
|
||||||
|
builder.Property(x => x.Id)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.HasOne(x => x.PersonActorRole)
|
||||||
|
.WithMany(x => x.RatingPersonActorRole)
|
||||||
|
.HasForeignKey(x => x.PersonActorRoleId)
|
||||||
|
.IsRequired();
|
||||||
|
builder.Property(x => x.PersonActorRoleId)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.HasOne(x => x.Account)
|
||||||
|
.WithMany(x => x.RatingPersonActorRole)
|
||||||
|
.HasForeignKey(x => x.AccountId)
|
||||||
|
.IsRequired();
|
||||||
|
builder.Property(x => x.AccountId)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.Rating)
|
||||||
|
.IsRequired();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using WatchIt.Database.Model.Person;
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Model.Rating
|
||||||
|
{
|
||||||
|
public class RatingPersonCreatorRole : IEntity<RatingPersonCreatorRole>
|
||||||
|
{
|
||||||
|
#region PROPERTIES
|
||||||
|
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
public Guid PersonCreatorRoleId { get; set; }
|
||||||
|
public long AccountId { get; set; }
|
||||||
|
public short Rating { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region NAVIGATION
|
||||||
|
|
||||||
|
public PersonCreatorRole PersonCreatorRole { get; set; }
|
||||||
|
public Account.Account Account { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region PUBLIC METHODS
|
||||||
|
|
||||||
|
static void IEntity<RatingPersonCreatorRole>.Build(EntityTypeBuilder<RatingPersonCreatorRole> builder)
|
||||||
|
{
|
||||||
|
builder.ToTable("RatingsPersonCreatorRole");
|
||||||
|
|
||||||
|
builder.HasKey(x => x.Id);
|
||||||
|
builder.HasIndex(x => x.Id)
|
||||||
|
.IsUnique();
|
||||||
|
builder.Property(x => x.Id)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.HasOne(x => x.PersonCreatorRole)
|
||||||
|
.WithMany(x => x.RatingPersonCreatorRole)
|
||||||
|
.HasForeignKey(x => x.PersonCreatorRoleId)
|
||||||
|
.IsRequired();
|
||||||
|
builder.Property(x => x.PersonCreatorRoleId)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.HasOne(x => x.Account)
|
||||||
|
.WithMany(x => x.RatingPersonCreatorRole)
|
||||||
|
.HasForeignKey(x => x.AccountId)
|
||||||
|
.IsRequired();
|
||||||
|
builder.Property(x => x.AccountId)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.Rating)
|
||||||
|
.IsRequired();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Model.ViewCount
|
||||||
|
{
|
||||||
|
public class ViewCountMedia : IEntity<ViewCountMedia>
|
||||||
|
{
|
||||||
|
#region PROPERTIES
|
||||||
|
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
public long MediaId { get; set; }
|
||||||
|
public DateOnly Date { get; set; }
|
||||||
|
public long ViewCount { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region NAVIGATION
|
||||||
|
|
||||||
|
public Media.Media Media { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region PUBLIC METHODS
|
||||||
|
|
||||||
|
static void IEntity<ViewCountMedia>.Build(EntityTypeBuilder<ViewCountMedia> builder)
|
||||||
|
{
|
||||||
|
builder.ToTable("ViewCountsMedia");
|
||||||
|
|
||||||
|
builder.HasKey(x => x.Id);
|
||||||
|
builder.HasIndex(x => x.Id)
|
||||||
|
.IsUnique();
|
||||||
|
builder.Property(x => x.Id)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.HasOne(x => x.Media)
|
||||||
|
.WithMany(x => x.ViewCountsMedia)
|
||||||
|
.HasForeignKey(x => x.MediaId)
|
||||||
|
.IsRequired();
|
||||||
|
builder.Property(x => x.MediaId)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.Date)
|
||||||
|
.IsRequired()
|
||||||
|
.HasDefaultValueSql("now()");
|
||||||
|
|
||||||
|
builder.Property(x => x.ViewCount)
|
||||||
|
.IsRequired()
|
||||||
|
.HasDefaultValue(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Model.ViewCount
|
||||||
|
{
|
||||||
|
public class ViewCountPerson : IEntity<ViewCountPerson>
|
||||||
|
{
|
||||||
|
#region PROPERTIES
|
||||||
|
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
public long PersonId { get; set; }
|
||||||
|
public DateOnly Date { get; set; }
|
||||||
|
public long ViewCount { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region NAVIGATION
|
||||||
|
|
||||||
|
public Person.Person Person { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region PUBLIC METHODS
|
||||||
|
|
||||||
|
static void IEntity<ViewCountPerson>.Build(EntityTypeBuilder<ViewCountPerson> builder)
|
||||||
|
{
|
||||||
|
builder.ToTable("ViewCountsPerson");
|
||||||
|
|
||||||
|
builder.HasKey(x => x.Id);
|
||||||
|
builder.HasIndex(x => x.Id)
|
||||||
|
.IsUnique();
|
||||||
|
builder.Property(x => x.Id)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.HasOne(x => x.Person)
|
||||||
|
.WithMany(x => x.ViewCountsPerson)
|
||||||
|
.HasForeignKey(x => x.PersonId)
|
||||||
|
.IsRequired();
|
||||||
|
builder.Property(x => x.PersonId)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.Date)
|
||||||
|
.IsRequired()
|
||||||
|
.HasDefaultValueSql("now()");
|
||||||
|
|
||||||
|
builder.Property(x => x.ViewCount)
|
||||||
|
.IsRequired()
|
||||||
|
.HasDefaultValue(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,6 +10,8 @@ using WatchIt.Database.Model.Account;
|
|||||||
using WatchIt.Database.Model.Common;
|
using WatchIt.Database.Model.Common;
|
||||||
using WatchIt.Database.Model.Media;
|
using WatchIt.Database.Model.Media;
|
||||||
using WatchIt.Database.Model.Person;
|
using WatchIt.Database.Model.Person;
|
||||||
|
using WatchIt.Database.Model.Rating;
|
||||||
|
using WatchIt.Database.Model.ViewCount;
|
||||||
|
|
||||||
namespace WatchIt.Database
|
namespace WatchIt.Database
|
||||||
{
|
{
|
||||||
@@ -30,6 +32,7 @@ namespace WatchIt.Database
|
|||||||
// Common
|
// Common
|
||||||
public virtual DbSet<Country> Countries { get; set; }
|
public virtual DbSet<Country> Countries { get; set; }
|
||||||
public virtual DbSet<Genre> Genres { get; set; }
|
public virtual DbSet<Genre> Genres { get; set; }
|
||||||
|
public virtual DbSet<Gender> Genders { get; set; }
|
||||||
|
|
||||||
// Account
|
// Account
|
||||||
public virtual DbSet<Account> Accounts { get; set; }
|
public virtual DbSet<Account> Accounts { get; set; }
|
||||||
@@ -54,6 +57,18 @@ namespace WatchIt.Database
|
|||||||
public virtual DbSet<PersonCreatorRole> PersonCreatorRoles { get; set; }
|
public virtual DbSet<PersonCreatorRole> PersonCreatorRoles { get; set; }
|
||||||
public virtual DbSet<PersonCreatorRoleType> PersonCreatorRoleTypes { get; set; }
|
public virtual DbSet<PersonCreatorRoleType> PersonCreatorRoleTypes { get; set; }
|
||||||
|
|
||||||
|
// Rating
|
||||||
|
public virtual DbSet<RatingMedia> RatingsMedia { get; set; }
|
||||||
|
public virtual DbSet<RatingPersonActorRole> RatingsPersonActorRole { get; set; }
|
||||||
|
public virtual DbSet<RatingPersonActorRole> RatingsPersonCreatorRole { get; set; }
|
||||||
|
public virtual DbSet<RatingMediaSeriesSeason> RatingsMediaSeriesSeason { get; set; }
|
||||||
|
public virtual DbSet<RatingMediaSeriesEpisode> RatingsMediaSeriesEpisode { get; set; }
|
||||||
|
|
||||||
|
// ViewCount
|
||||||
|
public virtual DbSet<ViewCountPerson> ViewCountsPerson { get; set; }
|
||||||
|
public virtual DbSet<ViewCountMedia> ViewCountsMedia { get; set; }
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
@@ -67,6 +82,7 @@ namespace WatchIt.Database
|
|||||||
// Common
|
// Common
|
||||||
EntityBuilder.Build<Country>(modelBuilder);
|
EntityBuilder.Build<Country>(modelBuilder);
|
||||||
EntityBuilder.Build<Genre>(modelBuilder);
|
EntityBuilder.Build<Genre>(modelBuilder);
|
||||||
|
EntityBuilder.Build<Gender>(modelBuilder);
|
||||||
|
|
||||||
// Account
|
// Account
|
||||||
EntityBuilder.Build<Account>(modelBuilder);
|
EntityBuilder.Build<Account>(modelBuilder);
|
||||||
@@ -90,6 +106,17 @@ namespace WatchIt.Database
|
|||||||
EntityBuilder.Build<PersonActorRoleType>(modelBuilder);
|
EntityBuilder.Build<PersonActorRoleType>(modelBuilder);
|
||||||
EntityBuilder.Build<PersonCreatorRole>(modelBuilder);
|
EntityBuilder.Build<PersonCreatorRole>(modelBuilder);
|
||||||
EntityBuilder.Build<PersonCreatorRoleType>(modelBuilder);
|
EntityBuilder.Build<PersonCreatorRoleType>(modelBuilder);
|
||||||
|
|
||||||
|
// Rating
|
||||||
|
EntityBuilder.Build<RatingMedia>(modelBuilder);
|
||||||
|
EntityBuilder.Build<RatingPersonActorRole>(modelBuilder);
|
||||||
|
EntityBuilder.Build<RatingPersonCreatorRole>(modelBuilder);
|
||||||
|
EntityBuilder.Build<RatingMediaSeriesSeason>(modelBuilder);
|
||||||
|
EntityBuilder.Build<RatingMediaSeriesEpisode>(modelBuilder);
|
||||||
|
|
||||||
|
// ViewCounts
|
||||||
|
EntityBuilder.Build<ViewCountMedia>(modelBuilder);
|
||||||
|
EntityBuilder.Build<ViewCountPerson>(modelBuilder);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -1,605 +0,0 @@
|
|||||||
// <auto-generated />
|
|
||||||
using System;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
||||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|
||||||
using WatchIt.Database;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace WatchIt.Database.Migrations
|
|
||||||
{
|
|
||||||
[DbContext(typeof(DatabaseContext))]
|
|
||||||
[Migration("20240319162326_0000_Initial")]
|
|
||||||
partial class _0000_Initial
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder
|
|
||||||
.HasAnnotation("ProductVersion", "8.0.3")
|
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
|
||||||
|
|
||||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Account.Account", b =>
|
|
||||||
{
|
|
||||||
b.Property<long>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
|
||||||
|
|
||||||
b.Property<Guid?>("BackgroundPictureId")
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<DateTime>("CreationDate")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("timestamp with time zone")
|
|
||||||
.HasDefaultValueSql("now()");
|
|
||||||
|
|
||||||
b.Property<string>("Description")
|
|
||||||
.IsRequired()
|
|
||||||
.HasMaxLength(1000)
|
|
||||||
.HasColumnType("character varying(1000)");
|
|
||||||
|
|
||||||
b.Property<string>("Email")
|
|
||||||
.IsRequired()
|
|
||||||
.HasMaxLength(320)
|
|
||||||
.HasColumnType("character varying(320)");
|
|
||||||
|
|
||||||
b.Property<bool>("IsAdmin")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<DateTime>("LastActive")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("timestamp with time zone")
|
|
||||||
.HasDefaultValueSql("now()");
|
|
||||||
|
|
||||||
b.Property<string>("LeftSalt")
|
|
||||||
.IsRequired()
|
|
||||||
.HasMaxLength(20)
|
|
||||||
.HasColumnType("character varying(20)");
|
|
||||||
|
|
||||||
b.Property<byte[]>("Password")
|
|
||||||
.IsRequired()
|
|
||||||
.HasMaxLength(1000)
|
|
||||||
.HasColumnType("bytea");
|
|
||||||
|
|
||||||
b.Property<Guid?>("ProfilePictureId")
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<string>("RightSalt")
|
|
||||||
.IsRequired()
|
|
||||||
.HasMaxLength(20)
|
|
||||||
.HasColumnType("character varying(20)");
|
|
||||||
|
|
||||||
b.Property<string>("Username")
|
|
||||||
.IsRequired()
|
|
||||||
.HasMaxLength(50)
|
|
||||||
.HasColumnType("character varying(50)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("BackgroundPictureId");
|
|
||||||
|
|
||||||
b.HasIndex("Id")
|
|
||||||
.IsUnique();
|
|
||||||
|
|
||||||
b.HasIndex("ProfilePictureId")
|
|
||||||
.IsUnique();
|
|
||||||
|
|
||||||
b.ToTable("Accounts");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Account.AccountProfilePicture", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<byte[]>("Image")
|
|
||||||
.IsRequired()
|
|
||||||
.HasMaxLength(-1)
|
|
||||||
.HasColumnType("bytea");
|
|
||||||
|
|
||||||
b.Property<string>("MimeType")
|
|
||||||
.IsRequired()
|
|
||||||
.HasMaxLength(50)
|
|
||||||
.HasColumnType("character varying(50)");
|
|
||||||
|
|
||||||
b.Property<DateTime>("UploadDate")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("timestamp with time zone")
|
|
||||||
.HasDefaultValueSql("now()");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("Id")
|
|
||||||
.IsUnique();
|
|
||||||
|
|
||||||
b.ToTable("AccountProfilePictures");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Common.Country", b =>
|
|
||||||
{
|
|
||||||
b.Property<short>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("smallint");
|
|
||||||
|
|
||||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<short>("Id"));
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.IsRequired()
|
|
||||||
.HasMaxLength(100)
|
|
||||||
.HasColumnType("character varying(100)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("Id")
|
|
||||||
.IsUnique();
|
|
||||||
|
|
||||||
b.ToTable("Countries");
|
|
||||||
|
|
||||||
b.HasData(
|
|
||||||
new
|
|
||||||
{
|
|
||||||
Id = (short)1,
|
|
||||||
Name = "Afghanistan"
|
|
||||||
},
|
|
||||||
new
|
|
||||||
{
|
|
||||||
Id = (short)2,
|
|
||||||
Name = "Albania"
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Common.Genre", b =>
|
|
||||||
{
|
|
||||||
b.Property<short>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("smallint");
|
|
||||||
|
|
||||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<short>("Id"));
|
|
||||||
|
|
||||||
b.Property<string>("Description")
|
|
||||||
.HasMaxLength(1000)
|
|
||||||
.HasColumnType("character varying(1000)");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.IsRequired()
|
|
||||||
.HasMaxLength(100)
|
|
||||||
.HasColumnType("character varying(100)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("Id")
|
|
||||||
.IsUnique();
|
|
||||||
|
|
||||||
b.ToTable("Genres");
|
|
||||||
|
|
||||||
b.HasData(
|
|
||||||
new
|
|
||||||
{
|
|
||||||
Id = (short)1,
|
|
||||||
Name = "Comedy"
|
|
||||||
},
|
|
||||||
new
|
|
||||||
{
|
|
||||||
Id = (short)2,
|
|
||||||
Name = "Thriller"
|
|
||||||
},
|
|
||||||
new
|
|
||||||
{
|
|
||||||
Id = (short)3,
|
|
||||||
Name = "Horror"
|
|
||||||
},
|
|
||||||
new
|
|
||||||
{
|
|
||||||
Id = (short)4,
|
|
||||||
Name = "Action"
|
|
||||||
},
|
|
||||||
new
|
|
||||||
{
|
|
||||||
Id = (short)5,
|
|
||||||
Name = "Drama"
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Media.Media", b =>
|
|
||||||
{
|
|
||||||
b.Property<long>("Id")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<string>("Description")
|
|
||||||
.HasMaxLength(1000)
|
|
||||||
.HasColumnType("character varying(1000)");
|
|
||||||
|
|
||||||
b.Property<TimeSpan?>("Length")
|
|
||||||
.HasColumnType("interval");
|
|
||||||
|
|
||||||
b.Property<Guid?>("MediaPosterImageId")
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<string>("OriginalTitle")
|
|
||||||
.HasMaxLength(250)
|
|
||||||
.HasColumnType("character varying(250)");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("ReleaseDate")
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<string>("Title")
|
|
||||||
.IsRequired()
|
|
||||||
.HasMaxLength(250)
|
|
||||||
.HasColumnType("character varying(250)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("Id")
|
|
||||||
.IsUnique();
|
|
||||||
|
|
||||||
b.HasIndex("MediaPosterImageId")
|
|
||||||
.IsUnique();
|
|
||||||
|
|
||||||
b.ToTable("Media");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaGenre", b =>
|
|
||||||
{
|
|
||||||
b.Property<short>("GenreId")
|
|
||||||
.HasColumnType("smallint");
|
|
||||||
|
|
||||||
b.Property<long>("MediaId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.HasKey("GenreId", "MediaId");
|
|
||||||
|
|
||||||
b.HasIndex("MediaId");
|
|
||||||
|
|
||||||
b.ToTable("MediaGenres");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaMovie", b =>
|
|
||||||
{
|
|
||||||
b.Property<long>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
|
||||||
|
|
||||||
b.Property<decimal?>("Budget")
|
|
||||||
.HasColumnType("money");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("Id")
|
|
||||||
.IsUnique();
|
|
||||||
|
|
||||||
b.ToTable("MediaMovies");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaPhotoImage", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<byte[]>("Image")
|
|
||||||
.IsRequired()
|
|
||||||
.HasMaxLength(-1)
|
|
||||||
.HasColumnType("bytea");
|
|
||||||
|
|
||||||
b.Property<bool>("IsMediaBackground")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("boolean")
|
|
||||||
.HasDefaultValue(false);
|
|
||||||
|
|
||||||
b.Property<bool>("IsUniversalBackground")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("boolean")
|
|
||||||
.HasDefaultValue(false);
|
|
||||||
|
|
||||||
b.Property<long>("MediaId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<string>("MimeType")
|
|
||||||
.IsRequired()
|
|
||||||
.HasMaxLength(50)
|
|
||||||
.HasColumnType("character varying(50)");
|
|
||||||
|
|
||||||
b.Property<DateTime>("UploadDate")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("timestamp with time zone")
|
|
||||||
.HasDefaultValueSql("now()");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("Id")
|
|
||||||
.IsUnique();
|
|
||||||
|
|
||||||
b.HasIndex("MediaId");
|
|
||||||
|
|
||||||
b.ToTable("MediaPhotoImages");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaPosterImage", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<byte[]>("Image")
|
|
||||||
.IsRequired()
|
|
||||||
.HasMaxLength(-1)
|
|
||||||
.HasColumnType("bytea");
|
|
||||||
|
|
||||||
b.Property<string>("MimeType")
|
|
||||||
.IsRequired()
|
|
||||||
.HasMaxLength(50)
|
|
||||||
.HasColumnType("character varying(50)");
|
|
||||||
|
|
||||||
b.Property<DateTime>("UploadDate")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("timestamp with time zone")
|
|
||||||
.HasDefaultValueSql("now()");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("Id")
|
|
||||||
.IsUnique();
|
|
||||||
|
|
||||||
b.ToTable("MediaPosterImages");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaProductionCountry", b =>
|
|
||||||
{
|
|
||||||
b.Property<short>("CountryId")
|
|
||||||
.HasColumnType("smallint");
|
|
||||||
|
|
||||||
b.Property<long>("MediaId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.HasKey("CountryId", "MediaId");
|
|
||||||
|
|
||||||
b.HasIndex("MediaId");
|
|
||||||
|
|
||||||
b.ToTable("MediaProductionCountrys");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeries", b =>
|
|
||||||
{
|
|
||||||
b.Property<long>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
|
||||||
|
|
||||||
b.Property<bool>("HasEnded")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("Id")
|
|
||||||
.IsUnique();
|
|
||||||
|
|
||||||
b.ToTable("MediaSeries");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeriesEpisode", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<bool>("IsSpecial")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("boolean")
|
|
||||||
.HasDefaultValue(false);
|
|
||||||
|
|
||||||
b.Property<Guid>("MediaSeriesSeasonId")
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<short>("Number")
|
|
||||||
.HasColumnType("smallint");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("Id")
|
|
||||||
.IsUnique();
|
|
||||||
|
|
||||||
b.HasIndex("MediaSeriesSeasonId");
|
|
||||||
|
|
||||||
b.ToTable("MediaSeriesEpisodes");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeriesSeason", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<long>("MediaSeriesId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<short>("Number")
|
|
||||||
.HasColumnType("smallint");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("Id")
|
|
||||||
.IsUnique();
|
|
||||||
|
|
||||||
b.HasIndex("MediaSeriesId");
|
|
||||||
|
|
||||||
b.ToTable("MediaSeriesSeasons");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Account.Account", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("WatchIt.Database.Model.Media.MediaPhotoImage", "BackgroundPicture")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("BackgroundPictureId");
|
|
||||||
|
|
||||||
b.HasOne("WatchIt.Database.Model.Account.AccountProfilePicture", "ProfilePicture")
|
|
||||||
.WithOne("Account")
|
|
||||||
.HasForeignKey("WatchIt.Database.Model.Account.Account", "ProfilePictureId");
|
|
||||||
|
|
||||||
b.Navigation("BackgroundPicture");
|
|
||||||
|
|
||||||
b.Navigation("ProfilePicture");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Media.Media", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("WatchIt.Database.Model.Media.MediaMovie", null)
|
|
||||||
.WithOne("Media")
|
|
||||||
.HasForeignKey("WatchIt.Database.Model.Media.Media", "Id")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("WatchIt.Database.Model.Media.MediaSeries", null)
|
|
||||||
.WithOne("Media")
|
|
||||||
.HasForeignKey("WatchIt.Database.Model.Media.Media", "Id")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("WatchIt.Database.Model.Media.MediaPosterImage", "MediaPosterImage")
|
|
||||||
.WithOne("Media")
|
|
||||||
.HasForeignKey("WatchIt.Database.Model.Media.Media", "MediaPosterImageId");
|
|
||||||
|
|
||||||
b.Navigation("MediaPosterImage");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaGenre", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("WatchIt.Database.Model.Common.Genre", "Genre")
|
|
||||||
.WithMany("MediaGenres")
|
|
||||||
.HasForeignKey("GenreId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("WatchIt.Database.Model.Media.Media", "Media")
|
|
||||||
.WithMany("MediaGenres")
|
|
||||||
.HasForeignKey("MediaId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Genre");
|
|
||||||
|
|
||||||
b.Navigation("Media");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaPhotoImage", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("WatchIt.Database.Model.Media.Media", "Media")
|
|
||||||
.WithMany("MediaPhotoImages")
|
|
||||||
.HasForeignKey("MediaId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Media");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaProductionCountry", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("WatchIt.Database.Model.Common.Country", "Country")
|
|
||||||
.WithMany("MediaProductionCountries")
|
|
||||||
.HasForeignKey("CountryId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("WatchIt.Database.Model.Media.Media", "Media")
|
|
||||||
.WithMany("MediaProductionCountries")
|
|
||||||
.HasForeignKey("MediaId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Country");
|
|
||||||
|
|
||||||
b.Navigation("Media");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeriesEpisode", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("WatchIt.Database.Model.Media.MediaSeriesSeason", "MediaSeriesSeason")
|
|
||||||
.WithMany("MediaSeriesEpisodes")
|
|
||||||
.HasForeignKey("MediaSeriesSeasonId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("MediaSeriesSeason");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeriesSeason", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("WatchIt.Database.Model.Media.MediaSeries", "MediaSeries")
|
|
||||||
.WithMany("MediaSeriesSeasons")
|
|
||||||
.HasForeignKey("MediaSeriesId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("MediaSeries");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Account.AccountProfilePicture", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Account")
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Common.Country", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("MediaProductionCountries");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Common.Genre", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("MediaGenres");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Media.Media", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("MediaGenres");
|
|
||||||
|
|
||||||
b.Navigation("MediaPhotoImages");
|
|
||||||
|
|
||||||
b.Navigation("MediaProductionCountries");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaMovie", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Media")
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaPosterImage", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Media")
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeries", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Media")
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("MediaSeriesSeasons");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeriesSeason", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("MediaSeriesEpisodes");
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,450 +0,0 @@
|
|||||||
using System;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
|
||||||
|
|
||||||
namespace WatchIt.Database.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class _0000_Initial : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "AccountProfilePictures",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
||||||
Image = table.Column<byte[]>(type: "bytea", maxLength: -1, nullable: false),
|
|
||||||
MimeType = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
|
|
||||||
UploadDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()")
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_AccountProfilePictures", x => x.Id);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Countries",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<short>(type: "smallint", nullable: false)
|
|
||||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
||||||
Name = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Countries", x => x.Id);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Genres",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<short>(type: "smallint", nullable: false)
|
|
||||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
||||||
Name = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
|
|
||||||
Description = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: true)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Genres", x => x.Id);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "MediaMovies",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<long>(type: "bigint", nullable: false)
|
|
||||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
||||||
Budget = table.Column<decimal>(type: "money", nullable: true)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_MediaMovies", x => x.Id);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "MediaPosterImages",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
||||||
Image = table.Column<byte[]>(type: "bytea", maxLength: -1, nullable: false),
|
|
||||||
MimeType = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
|
|
||||||
UploadDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()")
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_MediaPosterImages", x => x.Id);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "MediaSeries",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<long>(type: "bigint", nullable: false)
|
|
||||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
||||||
HasEnded = table.Column<bool>(type: "boolean", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_MediaSeries", x => x.Id);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Media",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<long>(type: "bigint", nullable: false),
|
|
||||||
Title = table.Column<string>(type: "character varying(250)", maxLength: 250, nullable: false),
|
|
||||||
OriginalTitle = table.Column<string>(type: "character varying(250)", maxLength: 250, nullable: true),
|
|
||||||
Description = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: true),
|
|
||||||
ReleaseDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
|
||||||
Length = table.Column<TimeSpan>(type: "interval", nullable: true),
|
|
||||||
MediaPosterImageId = table.Column<Guid>(type: "uuid", nullable: true)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Media", x => x.Id);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_Media_MediaMovies_Id",
|
|
||||||
column: x => x.Id,
|
|
||||||
principalTable: "MediaMovies",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_Media_MediaPosterImages_MediaPosterImageId",
|
|
||||||
column: x => x.MediaPosterImageId,
|
|
||||||
principalTable: "MediaPosterImages",
|
|
||||||
principalColumn: "Id");
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_Media_MediaSeries_Id",
|
|
||||||
column: x => x.Id,
|
|
||||||
principalTable: "MediaSeries",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "MediaSeriesSeasons",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
||||||
MediaSeriesId = table.Column<long>(type: "bigint", nullable: false),
|
|
||||||
Number = table.Column<short>(type: "smallint", nullable: false),
|
|
||||||
Name = table.Column<string>(type: "text", nullable: true)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_MediaSeriesSeasons", x => x.Id);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_MediaSeriesSeasons_MediaSeries_MediaSeriesId",
|
|
||||||
column: x => x.MediaSeriesId,
|
|
||||||
principalTable: "MediaSeries",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "MediaGenres",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
MediaId = table.Column<long>(type: "bigint", nullable: false),
|
|
||||||
GenreId = table.Column<short>(type: "smallint", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_MediaGenres", x => new { x.GenreId, x.MediaId });
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_MediaGenres_Genres_GenreId",
|
|
||||||
column: x => x.GenreId,
|
|
||||||
principalTable: "Genres",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_MediaGenres_Media_MediaId",
|
|
||||||
column: x => x.MediaId,
|
|
||||||
principalTable: "Media",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "MediaPhotoImages",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
||||||
MediaId = table.Column<long>(type: "bigint", nullable: false),
|
|
||||||
Image = table.Column<byte[]>(type: "bytea", maxLength: -1, nullable: false),
|
|
||||||
MimeType = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
|
|
||||||
UploadDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()"),
|
|
||||||
IsMediaBackground = table.Column<bool>(type: "boolean", nullable: false, defaultValue: false),
|
|
||||||
IsUniversalBackground = table.Column<bool>(type: "boolean", nullable: false, defaultValue: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_MediaPhotoImages", x => x.Id);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_MediaPhotoImages_Media_MediaId",
|
|
||||||
column: x => x.MediaId,
|
|
||||||
principalTable: "Media",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "MediaProductionCountrys",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
MediaId = table.Column<long>(type: "bigint", nullable: false),
|
|
||||||
CountryId = table.Column<short>(type: "smallint", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_MediaProductionCountrys", x => new { x.CountryId, x.MediaId });
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_MediaProductionCountrys_Countries_CountryId",
|
|
||||||
column: x => x.CountryId,
|
|
||||||
principalTable: "Countries",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_MediaProductionCountrys_Media_MediaId",
|
|
||||||
column: x => x.MediaId,
|
|
||||||
principalTable: "Media",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "MediaSeriesEpisodes",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
||||||
MediaSeriesSeasonId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
||||||
Number = table.Column<short>(type: "smallint", nullable: false),
|
|
||||||
Name = table.Column<string>(type: "text", nullable: true),
|
|
||||||
IsSpecial = table.Column<bool>(type: "boolean", nullable: false, defaultValue: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_MediaSeriesEpisodes", x => x.Id);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_MediaSeriesEpisodes_MediaSeriesSeasons_MediaSeriesSeasonId",
|
|
||||||
column: x => x.MediaSeriesSeasonId,
|
|
||||||
principalTable: "MediaSeriesSeasons",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Accounts",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<long>(type: "bigint", nullable: false)
|
|
||||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
||||||
Username = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
|
|
||||||
Email = table.Column<string>(type: "character varying(320)", maxLength: 320, nullable: false),
|
|
||||||
Description = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: false),
|
|
||||||
ProfilePictureId = table.Column<Guid>(type: "uuid", nullable: true),
|
|
||||||
BackgroundPictureId = table.Column<Guid>(type: "uuid", nullable: true),
|
|
||||||
Password = table.Column<byte[]>(type: "bytea", maxLength: 1000, nullable: false),
|
|
||||||
LeftSalt = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
|
|
||||||
RightSalt = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
|
|
||||||
IsAdmin = table.Column<bool>(type: "boolean", nullable: false),
|
|
||||||
CreationDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()"),
|
|
||||||
LastActive = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()")
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Accounts", x => x.Id);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_Accounts_AccountProfilePictures_ProfilePictureId",
|
|
||||||
column: x => x.ProfilePictureId,
|
|
||||||
principalTable: "AccountProfilePictures",
|
|
||||||
principalColumn: "Id");
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_Accounts_MediaPhotoImages_BackgroundPictureId",
|
|
||||||
column: x => x.BackgroundPictureId,
|
|
||||||
principalTable: "MediaPhotoImages",
|
|
||||||
principalColumn: "Id");
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.InsertData(
|
|
||||||
table: "Countries",
|
|
||||||
columns: new[] { "Id", "Name" },
|
|
||||||
values: new object[,]
|
|
||||||
{
|
|
||||||
{ (short)1, "Afghanistan" },
|
|
||||||
{ (short)2, "Albania" }
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.InsertData(
|
|
||||||
table: "Genres",
|
|
||||||
columns: new[] { "Id", "Description", "Name" },
|
|
||||||
values: new object[,]
|
|
||||||
{
|
|
||||||
{ (short)1, null, "Comedy" },
|
|
||||||
{ (short)2, null, "Thriller" },
|
|
||||||
{ (short)3, null, "Horror" },
|
|
||||||
{ (short)4, null, "Action" },
|
|
||||||
{ (short)5, null, "Drama" }
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_AccountProfilePictures_Id",
|
|
||||||
table: "AccountProfilePictures",
|
|
||||||
column: "Id",
|
|
||||||
unique: true);
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Accounts_BackgroundPictureId",
|
|
||||||
table: "Accounts",
|
|
||||||
column: "BackgroundPictureId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Accounts_Id",
|
|
||||||
table: "Accounts",
|
|
||||||
column: "Id",
|
|
||||||
unique: true);
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Accounts_ProfilePictureId",
|
|
||||||
table: "Accounts",
|
|
||||||
column: "ProfilePictureId",
|
|
||||||
unique: true);
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Countries_Id",
|
|
||||||
table: "Countries",
|
|
||||||
column: "Id",
|
|
||||||
unique: true);
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Genres_Id",
|
|
||||||
table: "Genres",
|
|
||||||
column: "Id",
|
|
||||||
unique: true);
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Media_Id",
|
|
||||||
table: "Media",
|
|
||||||
column: "Id",
|
|
||||||
unique: true);
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Media_MediaPosterImageId",
|
|
||||||
table: "Media",
|
|
||||||
column: "MediaPosterImageId",
|
|
||||||
unique: true);
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_MediaGenres_MediaId",
|
|
||||||
table: "MediaGenres",
|
|
||||||
column: "MediaId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_MediaMovies_Id",
|
|
||||||
table: "MediaMovies",
|
|
||||||
column: "Id",
|
|
||||||
unique: true);
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_MediaPhotoImages_Id",
|
|
||||||
table: "MediaPhotoImages",
|
|
||||||
column: "Id",
|
|
||||||
unique: true);
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_MediaPhotoImages_MediaId",
|
|
||||||
table: "MediaPhotoImages",
|
|
||||||
column: "MediaId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_MediaPosterImages_Id",
|
|
||||||
table: "MediaPosterImages",
|
|
||||||
column: "Id",
|
|
||||||
unique: true);
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_MediaProductionCountrys_MediaId",
|
|
||||||
table: "MediaProductionCountrys",
|
|
||||||
column: "MediaId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_MediaSeries_Id",
|
|
||||||
table: "MediaSeries",
|
|
||||||
column: "Id",
|
|
||||||
unique: true);
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_MediaSeriesEpisodes_Id",
|
|
||||||
table: "MediaSeriesEpisodes",
|
|
||||||
column: "Id",
|
|
||||||
unique: true);
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_MediaSeriesEpisodes_MediaSeriesSeasonId",
|
|
||||||
table: "MediaSeriesEpisodes",
|
|
||||||
column: "MediaSeriesSeasonId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_MediaSeriesSeasons_Id",
|
|
||||||
table: "MediaSeriesSeasons",
|
|
||||||
column: "Id",
|
|
||||||
unique: true);
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_MediaSeriesSeasons_MediaSeriesId",
|
|
||||||
table: "MediaSeriesSeasons",
|
|
||||||
column: "MediaSeriesId");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Accounts");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "MediaGenres");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "MediaProductionCountrys");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "MediaSeriesEpisodes");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "AccountProfilePictures");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "MediaPhotoImages");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Genres");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Countries");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "MediaSeriesSeasons");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Media");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "MediaMovies");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "MediaPosterImages");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "MediaSeries");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
using System;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace WatchIt.Database.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class _0001_PersonTableAdded : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "PersonPhotoImages",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
||||||
Image = table.Column<byte[]>(type: "bytea", maxLength: -1, nullable: false),
|
|
||||||
MimeType = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
|
|
||||||
UploadDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()")
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_PersonPhotoImages", x => x.Id);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Persons",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<long>(type: "bigint", nullable: false)
|
|
||||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
||||||
Name = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
|
|
||||||
FullName = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: true),
|
|
||||||
Description = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: true),
|
|
||||||
BirthDate = table.Column<DateOnly>(type: "date", nullable: true),
|
|
||||||
DeathDate = table.Column<DateOnly>(type: "date", nullable: true),
|
|
||||||
PersonPhotoId = table.Column<Guid>(type: "uuid", nullable: true)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Persons", x => x.Id);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_Persons_PersonPhotoImages_PersonPhotoId",
|
|
||||||
column: x => x.PersonPhotoId,
|
|
||||||
principalTable: "PersonPhotoImages",
|
|
||||||
principalColumn: "Id");
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_PersonPhotoImages_Id",
|
|
||||||
table: "PersonPhotoImages",
|
|
||||||
column: "Id",
|
|
||||||
unique: true);
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Persons_Id",
|
|
||||||
table: "Persons",
|
|
||||||
column: "Id",
|
|
||||||
unique: true);
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Persons_PersonPhotoId",
|
|
||||||
table: "Persons",
|
|
||||||
column: "PersonPhotoId",
|
|
||||||
unique: true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Persons");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "PersonPhotoImages");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,111 +0,0 @@
|
|||||||
using System;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
|
||||||
|
|
||||||
namespace WatchIt.Database.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class _0002_PersonActorTableAdded : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "PersonActorRoleTypes",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<short>(type: "smallint", nullable: false)
|
|
||||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
||||||
Name = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_PersonActorRoleTypes", x => x.Id);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "PersonActorRoles",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
||||||
PersonId = table.Column<long>(type: "bigint", nullable: false),
|
|
||||||
MediaId = table.Column<long>(type: "bigint", nullable: false),
|
|
||||||
PersonActorRoleTypeId = table.Column<short>(type: "smallint", nullable: false),
|
|
||||||
RoleName = table.Column<string>(type: "text", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_PersonActorRoles", x => x.Id);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_PersonActorRoles_Media_MediaId",
|
|
||||||
column: x => x.MediaId,
|
|
||||||
principalTable: "Media",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_PersonActorRoles_PersonActorRoleTypes_PersonActorRoleTypeId",
|
|
||||||
column: x => x.PersonActorRoleTypeId,
|
|
||||||
principalTable: "PersonActorRoleTypes",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_PersonActorRoles_Persons_PersonId",
|
|
||||||
column: x => x.PersonId,
|
|
||||||
principalTable: "Persons",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.InsertData(
|
|
||||||
table: "PersonActorRoleTypes",
|
|
||||||
columns: new[] { "Id", "Name" },
|
|
||||||
values: new object[,]
|
|
||||||
{
|
|
||||||
{ (short)1, "Actor" },
|
|
||||||
{ (short)2, "Supporting actor" },
|
|
||||||
{ (short)3, "Voice actor" }
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_PersonActorRoles_Id",
|
|
||||||
table: "PersonActorRoles",
|
|
||||||
column: "Id",
|
|
||||||
unique: true);
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_PersonActorRoles_MediaId",
|
|
||||||
table: "PersonActorRoles",
|
|
||||||
column: "MediaId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_PersonActorRoles_PersonActorRoleTypeId",
|
|
||||||
table: "PersonActorRoles",
|
|
||||||
column: "PersonActorRoleTypeId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_PersonActorRoles_PersonId",
|
|
||||||
table: "PersonActorRoles",
|
|
||||||
column: "PersonId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_PersonActorRoleTypes_Id",
|
|
||||||
table: "PersonActorRoleTypes",
|
|
||||||
column: "Id",
|
|
||||||
unique: true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "PersonActorRoles");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "PersonActorRoleTypes");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,110 +0,0 @@
|
|||||||
using System;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
|
||||||
|
|
||||||
namespace WatchIt.Database.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class _0003_PersonCreatorTableAdded : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "PersonCreatorRoleTypes",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<short>(type: "smallint", nullable: false)
|
|
||||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
||||||
Name = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_PersonCreatorRoleTypes", x => x.Id);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "PersonCreatorRoles",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
||||||
PersonId = table.Column<long>(type: "bigint", nullable: false),
|
|
||||||
MediaId = table.Column<long>(type: "bigint", nullable: false),
|
|
||||||
PersonCreatorRoleTypeId = table.Column<short>(type: "smallint", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_PersonCreatorRoles", x => x.Id);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_PersonCreatorRoles_Media_MediaId",
|
|
||||||
column: x => x.MediaId,
|
|
||||||
principalTable: "Media",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_PersonCreatorRoles_PersonCreatorRoleTypes_PersonCreatorRole~",
|
|
||||||
column: x => x.PersonCreatorRoleTypeId,
|
|
||||||
principalTable: "PersonCreatorRoleTypes",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_PersonCreatorRoles_Persons_PersonId",
|
|
||||||
column: x => x.PersonId,
|
|
||||||
principalTable: "Persons",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.InsertData(
|
|
||||||
table: "PersonCreatorRoleTypes",
|
|
||||||
columns: new[] { "Id", "Name" },
|
|
||||||
values: new object[,]
|
|
||||||
{
|
|
||||||
{ (short)1, "Director" },
|
|
||||||
{ (short)2, "Producer" },
|
|
||||||
{ (short)3, "Screenwriter" }
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_PersonCreatorRoles_Id",
|
|
||||||
table: "PersonCreatorRoles",
|
|
||||||
column: "Id",
|
|
||||||
unique: true);
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_PersonCreatorRoles_MediaId",
|
|
||||||
table: "PersonCreatorRoles",
|
|
||||||
column: "MediaId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_PersonCreatorRoles_PersonCreatorRoleTypeId",
|
|
||||||
table: "PersonCreatorRoles",
|
|
||||||
column: "PersonCreatorRoleTypeId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_PersonCreatorRoles_PersonId",
|
|
||||||
table: "PersonCreatorRoles",
|
|
||||||
column: "PersonId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_PersonCreatorRoleTypes_Id",
|
|
||||||
table: "PersonCreatorRoleTypes",
|
|
||||||
column: "Id",
|
|
||||||
unique: true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "PersonCreatorRoles");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "PersonCreatorRoleTypes");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -12,8 +12,8 @@ using WatchIt.Database;
|
|||||||
namespace WatchIt.Database.Migrations
|
namespace WatchIt.Database.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(DatabaseContext))]
|
[DbContext(typeof(DatabaseContext))]
|
||||||
[Migration("20240319233241_0003_PersonCreatorTableAdded")]
|
[Migration("20240321165113_0000_Initial")]
|
||||||
partial class _0003_PersonCreatorTableAdded
|
partial class _0000_Initial
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
@@ -51,6 +51,9 @@ namespace WatchIt.Database.Migrations
|
|||||||
.HasMaxLength(320)
|
.HasMaxLength(320)
|
||||||
.HasColumnType("character varying(320)");
|
.HasColumnType("character varying(320)");
|
||||||
|
|
||||||
|
b.Property<short>("GenderId")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
b.Property<bool>("IsAdmin")
|
b.Property<bool>("IsAdmin")
|
||||||
.HasColumnType("boolean");
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
@@ -86,6 +89,8 @@ namespace WatchIt.Database.Migrations
|
|||||||
|
|
||||||
b.HasIndex("BackgroundPictureId");
|
b.HasIndex("BackgroundPictureId");
|
||||||
|
|
||||||
|
b.HasIndex("GenderId");
|
||||||
|
|
||||||
b.HasIndex("Id")
|
b.HasIndex("Id")
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
|
|
||||||
@@ -157,6 +162,23 @@ namespace WatchIt.Database.Migrations
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Common.Gender", b =>
|
||||||
|
{
|
||||||
|
b.Property<short>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<short>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Gender");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Common.Genre", b =>
|
modelBuilder.Entity("WatchIt.Database.Model.Common.Genre", b =>
|
||||||
{
|
{
|
||||||
b.Property<short>("Id")
|
b.Property<short>("Id")
|
||||||
@@ -465,6 +487,9 @@ namespace WatchIt.Database.Migrations
|
|||||||
.HasMaxLength(200)
|
.HasMaxLength(200)
|
||||||
.HasColumnType("character varying(200)");
|
.HasColumnType("character varying(200)");
|
||||||
|
|
||||||
|
b.Property<short>("GenderId")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
b.Property<string>("Name")
|
b.Property<string>("Name")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasMaxLength(100)
|
.HasMaxLength(100)
|
||||||
@@ -475,6 +500,8 @@ namespace WatchIt.Database.Migrations
|
|||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("GenderId");
|
||||||
|
|
||||||
b.HasIndex("Id")
|
b.HasIndex("Id")
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
|
|
||||||
@@ -651,18 +678,161 @@ namespace WatchIt.Database.Migrations
|
|||||||
b.ToTable("PersonPhotoImages");
|
b.ToTable("PersonPhotoImages");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingMedia", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<long>("AccountId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<long>("MediaId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<short>("Rating")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("AccountId");
|
||||||
|
|
||||||
|
b.HasIndex("Id")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.HasIndex("MediaId");
|
||||||
|
|
||||||
|
b.ToTable("RatingsMedia");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingMediaSeriesEpisode", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<long>("AccountId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<Guid>("MediaSeriesEpisodeId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<short>("Rating")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("AccountId");
|
||||||
|
|
||||||
|
b.HasIndex("Id")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.HasIndex("MediaSeriesEpisodeId");
|
||||||
|
|
||||||
|
b.ToTable("RatingsMediaSeriesEpisode");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingMediaSeriesSeason", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<long>("AccountId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<Guid>("MediaSeriesSeasonId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<short>("Rating")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("AccountId");
|
||||||
|
|
||||||
|
b.HasIndex("Id")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.HasIndex("MediaSeriesSeasonId");
|
||||||
|
|
||||||
|
b.ToTable("RatingsMediaSeriesSeason");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingPersonActorRole", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<long>("AccountId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<Guid>("PersonActorRoleId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<short>("Rating")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("AccountId");
|
||||||
|
|
||||||
|
b.HasIndex("Id")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.HasIndex("PersonActorRoleId");
|
||||||
|
|
||||||
|
b.ToTable("RatingsPersonActorRole", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingPersonCreatorRole", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<long>("AccountId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<Guid>("PersonCreatorRoleId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<short>("Rating")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("AccountId");
|
||||||
|
|
||||||
|
b.HasIndex("Id")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.HasIndex("PersonCreatorRoleId");
|
||||||
|
|
||||||
|
b.ToTable("RatingsPersonCreatorRole", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Account.Account", b =>
|
modelBuilder.Entity("WatchIt.Database.Model.Account.Account", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("WatchIt.Database.Model.Media.MediaPhotoImage", "BackgroundPicture")
|
b.HasOne("WatchIt.Database.Model.Media.MediaPhotoImage", "BackgroundPicture")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("BackgroundPictureId");
|
.HasForeignKey("BackgroundPictureId");
|
||||||
|
|
||||||
|
b.HasOne("WatchIt.Database.Model.Common.Gender", "Gender")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("GenderId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
b.HasOne("WatchIt.Database.Model.Account.AccountProfilePicture", "ProfilePicture")
|
b.HasOne("WatchIt.Database.Model.Account.AccountProfilePicture", "ProfilePicture")
|
||||||
.WithOne("Account")
|
.WithOne("Account")
|
||||||
.HasForeignKey("WatchIt.Database.Model.Account.Account", "ProfilePictureId");
|
.HasForeignKey("WatchIt.Database.Model.Account.Account", "ProfilePictureId");
|
||||||
|
|
||||||
b.Navigation("BackgroundPicture");
|
b.Navigation("BackgroundPicture");
|
||||||
|
|
||||||
|
b.Navigation("Gender");
|
||||||
|
|
||||||
b.Navigation("ProfilePicture");
|
b.Navigation("ProfilePicture");
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -760,10 +930,18 @@ namespace WatchIt.Database.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Person.Person", b =>
|
modelBuilder.Entity("WatchIt.Database.Model.Person.Person", b =>
|
||||||
{
|
{
|
||||||
|
b.HasOne("WatchIt.Database.Model.Common.Gender", "Gender")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("GenderId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
b.HasOne("WatchIt.Database.Model.Person.PersonPhotoImage", "PersonPhoto")
|
b.HasOne("WatchIt.Database.Model.Person.PersonPhotoImage", "PersonPhoto")
|
||||||
.WithOne("Person")
|
.WithOne("Person")
|
||||||
.HasForeignKey("WatchIt.Database.Model.Person.Person", "PersonPhotoId");
|
.HasForeignKey("WatchIt.Database.Model.Person.Person", "PersonPhotoId");
|
||||||
|
|
||||||
|
b.Navigation("Gender");
|
||||||
|
|
||||||
b.Navigation("PersonPhoto");
|
b.Navigation("PersonPhoto");
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -821,6 +999,114 @@ namespace WatchIt.Database.Migrations
|
|||||||
b.Navigation("PersonCreatorRoleType");
|
b.Navigation("PersonCreatorRoleType");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingMedia", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("WatchIt.Database.Model.Account.Account", "Account")
|
||||||
|
.WithMany("RatingMedia")
|
||||||
|
.HasForeignKey("AccountId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("WatchIt.Database.Model.Media.Media", "Media")
|
||||||
|
.WithMany("RatingMedia")
|
||||||
|
.HasForeignKey("MediaId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Account");
|
||||||
|
|
||||||
|
b.Navigation("Media");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingMediaSeriesEpisode", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("WatchIt.Database.Model.Account.Account", "Account")
|
||||||
|
.WithMany("RatingMediaSeriesEpisode")
|
||||||
|
.HasForeignKey("AccountId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("WatchIt.Database.Model.Media.MediaSeriesEpisode", "MediaSeriesEpisode")
|
||||||
|
.WithMany("RatingMediaSeriesEpisode")
|
||||||
|
.HasForeignKey("MediaSeriesEpisodeId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Account");
|
||||||
|
|
||||||
|
b.Navigation("MediaSeriesEpisode");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingMediaSeriesSeason", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("WatchIt.Database.Model.Account.Account", "Account")
|
||||||
|
.WithMany("RatingMediaSeriesSeason")
|
||||||
|
.HasForeignKey("AccountId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("WatchIt.Database.Model.Media.MediaSeriesSeason", "MediaSeriesSeason")
|
||||||
|
.WithMany("RatingMediaSeriesSeason")
|
||||||
|
.HasForeignKey("MediaSeriesSeasonId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Account");
|
||||||
|
|
||||||
|
b.Navigation("MediaSeriesSeason");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingPersonActorRole", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("WatchIt.Database.Model.Account.Account", "Account")
|
||||||
|
.WithMany("RatingPersonActorRole")
|
||||||
|
.HasForeignKey("AccountId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("WatchIt.Database.Model.Person.PersonActorRole", "PersonActorRole")
|
||||||
|
.WithMany("RatingPersonActorRole")
|
||||||
|
.HasForeignKey("PersonActorRoleId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Account");
|
||||||
|
|
||||||
|
b.Navigation("PersonActorRole");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingPersonCreatorRole", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("WatchIt.Database.Model.Account.Account", "Account")
|
||||||
|
.WithMany("RatingPersonCreatorRole")
|
||||||
|
.HasForeignKey("AccountId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("WatchIt.Database.Model.Person.PersonCreatorRole", "PersonCreatorRole")
|
||||||
|
.WithMany("RatingPersonCreatorRole")
|
||||||
|
.HasForeignKey("PersonCreatorRoleId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Account");
|
||||||
|
|
||||||
|
b.Navigation("PersonCreatorRole");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Account.Account", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("RatingMedia");
|
||||||
|
|
||||||
|
b.Navigation("RatingMediaSeriesEpisode");
|
||||||
|
|
||||||
|
b.Navigation("RatingMediaSeriesSeason");
|
||||||
|
|
||||||
|
b.Navigation("RatingPersonActorRole");
|
||||||
|
|
||||||
|
b.Navigation("RatingPersonCreatorRole");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Account.AccountProfilePicture", b =>
|
modelBuilder.Entity("WatchIt.Database.Model.Account.AccountProfilePicture", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("Account")
|
b.Navigation("Account")
|
||||||
@@ -848,6 +1134,8 @@ namespace WatchIt.Database.Migrations
|
|||||||
b.Navigation("PersonActorRoles");
|
b.Navigation("PersonActorRoles");
|
||||||
|
|
||||||
b.Navigation("PersonCreatorRoles");
|
b.Navigation("PersonCreatorRoles");
|
||||||
|
|
||||||
|
b.Navigation("RatingMedia");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaMovie", b =>
|
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaMovie", b =>
|
||||||
@@ -870,9 +1158,16 @@ namespace WatchIt.Database.Migrations
|
|||||||
b.Navigation("MediaSeriesSeasons");
|
b.Navigation("MediaSeriesSeasons");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeriesEpisode", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("RatingMediaSeriesEpisode");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeriesSeason", b =>
|
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeriesSeason", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("MediaSeriesEpisodes");
|
b.Navigation("MediaSeriesEpisodes");
|
||||||
|
|
||||||
|
b.Navigation("RatingMediaSeriesSeason");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Person.Person", b =>
|
modelBuilder.Entity("WatchIt.Database.Model.Person.Person", b =>
|
||||||
@@ -882,6 +1177,16 @@ namespace WatchIt.Database.Migrations
|
|||||||
b.Navigation("PersonCreatorRoles");
|
b.Navigation("PersonCreatorRoles");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Person.PersonActorRole", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("RatingPersonActorRole");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Person.PersonCreatorRole", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("RatingPersonCreatorRole");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Person.PersonPhotoImage", b =>
|
modelBuilder.Entity("WatchIt.Database.Model.Person.PersonPhotoImage", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("Person")
|
b.Navigation("Person")
|
||||||
@@ -0,0 +1,953 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class _0000_Initial : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "AccountProfilePictures",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
Image = table.Column<byte[]>(type: "bytea", maxLength: -1, nullable: false),
|
||||||
|
MimeType = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
|
||||||
|
UploadDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()")
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_AccountProfilePictures", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Countries",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<short>(type: "smallint", nullable: false)
|
||||||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
|
Name = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Countries", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Gender",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<short>(type: "smallint", nullable: false)
|
||||||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
|
Name = table.Column<string>(type: "text", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Gender", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Genres",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<short>(type: "smallint", nullable: false)
|
||||||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
|
Name = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
|
||||||
|
Description = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Genres", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "MediaMovies",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<long>(type: "bigint", nullable: false)
|
||||||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
|
Budget = table.Column<decimal>(type: "money", nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_MediaMovies", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "MediaPosterImages",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
Image = table.Column<byte[]>(type: "bytea", maxLength: -1, nullable: false),
|
||||||
|
MimeType = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
|
||||||
|
UploadDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()")
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_MediaPosterImages", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "MediaSeries",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<long>(type: "bigint", nullable: false)
|
||||||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
|
HasEnded = table.Column<bool>(type: "boolean", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_MediaSeries", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "PersonActorRoleTypes",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<short>(type: "smallint", nullable: false)
|
||||||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
|
Name = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_PersonActorRoleTypes", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "PersonCreatorRoleTypes",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<short>(type: "smallint", nullable: false)
|
||||||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
|
Name = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_PersonCreatorRoleTypes", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "PersonPhotoImages",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
Image = table.Column<byte[]>(type: "bytea", maxLength: -1, nullable: false),
|
||||||
|
MimeType = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
|
||||||
|
UploadDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()")
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_PersonPhotoImages", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Media",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<long>(type: "bigint", nullable: false),
|
||||||
|
Title = table.Column<string>(type: "character varying(250)", maxLength: 250, nullable: false),
|
||||||
|
OriginalTitle = table.Column<string>(type: "character varying(250)", maxLength: 250, nullable: true),
|
||||||
|
Description = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: true),
|
||||||
|
ReleaseDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
||||||
|
Length = table.Column<TimeSpan>(type: "interval", nullable: true),
|
||||||
|
MediaPosterImageId = table.Column<Guid>(type: "uuid", nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Media", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Media_MediaMovies_Id",
|
||||||
|
column: x => x.Id,
|
||||||
|
principalTable: "MediaMovies",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Media_MediaPosterImages_MediaPosterImageId",
|
||||||
|
column: x => x.MediaPosterImageId,
|
||||||
|
principalTable: "MediaPosterImages",
|
||||||
|
principalColumn: "Id");
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Media_MediaSeries_Id",
|
||||||
|
column: x => x.Id,
|
||||||
|
principalTable: "MediaSeries",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "MediaSeriesSeasons",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
MediaSeriesId = table.Column<long>(type: "bigint", nullable: false),
|
||||||
|
Number = table.Column<short>(type: "smallint", nullable: false),
|
||||||
|
Name = table.Column<string>(type: "text", nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_MediaSeriesSeasons", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_MediaSeriesSeasons_MediaSeries_MediaSeriesId",
|
||||||
|
column: x => x.MediaSeriesId,
|
||||||
|
principalTable: "MediaSeries",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Persons",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<long>(type: "bigint", nullable: false)
|
||||||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
|
Name = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
|
||||||
|
FullName = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: true),
|
||||||
|
Description = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: true),
|
||||||
|
BirthDate = table.Column<DateOnly>(type: "date", nullable: true),
|
||||||
|
DeathDate = table.Column<DateOnly>(type: "date", nullable: true),
|
||||||
|
GenderId = table.Column<short>(type: "smallint", nullable: false),
|
||||||
|
PersonPhotoId = table.Column<Guid>(type: "uuid", nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Persons", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Persons_Gender_GenderId",
|
||||||
|
column: x => x.GenderId,
|
||||||
|
principalTable: "Gender",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Persons_PersonPhotoImages_PersonPhotoId",
|
||||||
|
column: x => x.PersonPhotoId,
|
||||||
|
principalTable: "PersonPhotoImages",
|
||||||
|
principalColumn: "Id");
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "MediaGenres",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
MediaId = table.Column<long>(type: "bigint", nullable: false),
|
||||||
|
GenreId = table.Column<short>(type: "smallint", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_MediaGenres", x => new { x.GenreId, x.MediaId });
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_MediaGenres_Genres_GenreId",
|
||||||
|
column: x => x.GenreId,
|
||||||
|
principalTable: "Genres",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_MediaGenres_Media_MediaId",
|
||||||
|
column: x => x.MediaId,
|
||||||
|
principalTable: "Media",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "MediaPhotoImages",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
MediaId = table.Column<long>(type: "bigint", nullable: false),
|
||||||
|
Image = table.Column<byte[]>(type: "bytea", maxLength: -1, nullable: false),
|
||||||
|
MimeType = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
|
||||||
|
UploadDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()"),
|
||||||
|
IsMediaBackground = table.Column<bool>(type: "boolean", nullable: false, defaultValue: false),
|
||||||
|
IsUniversalBackground = table.Column<bool>(type: "boolean", nullable: false, defaultValue: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_MediaPhotoImages", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_MediaPhotoImages_Media_MediaId",
|
||||||
|
column: x => x.MediaId,
|
||||||
|
principalTable: "Media",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "MediaProductionCountrys",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
MediaId = table.Column<long>(type: "bigint", nullable: false),
|
||||||
|
CountryId = table.Column<short>(type: "smallint", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_MediaProductionCountrys", x => new { x.CountryId, x.MediaId });
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_MediaProductionCountrys_Countries_CountryId",
|
||||||
|
column: x => x.CountryId,
|
||||||
|
principalTable: "Countries",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_MediaProductionCountrys_Media_MediaId",
|
||||||
|
column: x => x.MediaId,
|
||||||
|
principalTable: "Media",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "MediaSeriesEpisodes",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
MediaSeriesSeasonId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
Number = table.Column<short>(type: "smallint", nullable: false),
|
||||||
|
Name = table.Column<string>(type: "text", nullable: true),
|
||||||
|
IsSpecial = table.Column<bool>(type: "boolean", nullable: false, defaultValue: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_MediaSeriesEpisodes", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_MediaSeriesEpisodes_MediaSeriesSeasons_MediaSeriesSeasonId",
|
||||||
|
column: x => x.MediaSeriesSeasonId,
|
||||||
|
principalTable: "MediaSeriesSeasons",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "PersonActorRoles",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
PersonId = table.Column<long>(type: "bigint", nullable: false),
|
||||||
|
MediaId = table.Column<long>(type: "bigint", nullable: false),
|
||||||
|
PersonActorRoleTypeId = table.Column<short>(type: "smallint", nullable: false),
|
||||||
|
RoleName = table.Column<string>(type: "text", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_PersonActorRoles", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_PersonActorRoles_Media_MediaId",
|
||||||
|
column: x => x.MediaId,
|
||||||
|
principalTable: "Media",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_PersonActorRoles_PersonActorRoleTypes_PersonActorRoleTypeId",
|
||||||
|
column: x => x.PersonActorRoleTypeId,
|
||||||
|
principalTable: "PersonActorRoleTypes",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_PersonActorRoles_Persons_PersonId",
|
||||||
|
column: x => x.PersonId,
|
||||||
|
principalTable: "Persons",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "PersonCreatorRoles",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
PersonId = table.Column<long>(type: "bigint", nullable: false),
|
||||||
|
MediaId = table.Column<long>(type: "bigint", nullable: false),
|
||||||
|
PersonCreatorRoleTypeId = table.Column<short>(type: "smallint", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_PersonCreatorRoles", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_PersonCreatorRoles_Media_MediaId",
|
||||||
|
column: x => x.MediaId,
|
||||||
|
principalTable: "Media",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_PersonCreatorRoles_PersonCreatorRoleTypes_PersonCreatorRole~",
|
||||||
|
column: x => x.PersonCreatorRoleTypeId,
|
||||||
|
principalTable: "PersonCreatorRoleTypes",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_PersonCreatorRoles_Persons_PersonId",
|
||||||
|
column: x => x.PersonId,
|
||||||
|
principalTable: "Persons",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Accounts",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<long>(type: "bigint", nullable: false)
|
||||||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
|
Username = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
|
||||||
|
Email = table.Column<string>(type: "character varying(320)", maxLength: 320, nullable: false),
|
||||||
|
Description = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: false),
|
||||||
|
GenderId = table.Column<short>(type: "smallint", nullable: false),
|
||||||
|
ProfilePictureId = table.Column<Guid>(type: "uuid", nullable: true),
|
||||||
|
BackgroundPictureId = table.Column<Guid>(type: "uuid", nullable: true),
|
||||||
|
Password = table.Column<byte[]>(type: "bytea", maxLength: 1000, nullable: false),
|
||||||
|
LeftSalt = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
|
||||||
|
RightSalt = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
|
||||||
|
IsAdmin = table.Column<bool>(type: "boolean", nullable: false),
|
||||||
|
CreationDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()"),
|
||||||
|
LastActive = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()")
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Accounts", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Accounts_AccountProfilePictures_ProfilePictureId",
|
||||||
|
column: x => x.ProfilePictureId,
|
||||||
|
principalTable: "AccountProfilePictures",
|
||||||
|
principalColumn: "Id");
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Accounts_Gender_GenderId",
|
||||||
|
column: x => x.GenderId,
|
||||||
|
principalTable: "Gender",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Accounts_MediaPhotoImages_BackgroundPictureId",
|
||||||
|
column: x => x.BackgroundPictureId,
|
||||||
|
principalTable: "MediaPhotoImages",
|
||||||
|
principalColumn: "Id");
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "RatingsMedia",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
MediaId = table.Column<long>(type: "bigint", nullable: false),
|
||||||
|
AccountId = table.Column<long>(type: "bigint", nullable: false),
|
||||||
|
Rating = table.Column<short>(type: "smallint", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_RatingsMedia", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_RatingsMedia_Accounts_AccountId",
|
||||||
|
column: x => x.AccountId,
|
||||||
|
principalTable: "Accounts",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_RatingsMedia_Media_MediaId",
|
||||||
|
column: x => x.MediaId,
|
||||||
|
principalTable: "Media",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "RatingsMediaSeriesEpisode",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
MediaSeriesEpisodeId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
AccountId = table.Column<long>(type: "bigint", nullable: false),
|
||||||
|
Rating = table.Column<short>(type: "smallint", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_RatingsMediaSeriesEpisode", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_RatingsMediaSeriesEpisode_Accounts_AccountId",
|
||||||
|
column: x => x.AccountId,
|
||||||
|
principalTable: "Accounts",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_RatingsMediaSeriesEpisode_MediaSeriesEpisodes_MediaSeriesEp~",
|
||||||
|
column: x => x.MediaSeriesEpisodeId,
|
||||||
|
principalTable: "MediaSeriesEpisodes",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "RatingsMediaSeriesSeason",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
MediaSeriesSeasonId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
AccountId = table.Column<long>(type: "bigint", nullable: false),
|
||||||
|
Rating = table.Column<short>(type: "smallint", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_RatingsMediaSeriesSeason", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_RatingsMediaSeriesSeason_Accounts_AccountId",
|
||||||
|
column: x => x.AccountId,
|
||||||
|
principalTable: "Accounts",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_RatingsMediaSeriesSeason_MediaSeriesSeasons_MediaSeriesSeas~",
|
||||||
|
column: x => x.MediaSeriesSeasonId,
|
||||||
|
principalTable: "MediaSeriesSeasons",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "RatingsPersonActorRole",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
PersonActorRoleId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
AccountId = table.Column<long>(type: "bigint", nullable: false),
|
||||||
|
Rating = table.Column<short>(type: "smallint", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_RatingsPersonActorRole", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_RatingsPersonActorRole_Accounts_AccountId",
|
||||||
|
column: x => x.AccountId,
|
||||||
|
principalTable: "Accounts",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_RatingsPersonActorRole_PersonActorRoles_PersonActorRoleId",
|
||||||
|
column: x => x.PersonActorRoleId,
|
||||||
|
principalTable: "PersonActorRoles",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "RatingsPersonCreatorRole",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
PersonCreatorRoleId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
AccountId = table.Column<long>(type: "bigint", nullable: false),
|
||||||
|
Rating = table.Column<short>(type: "smallint", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_RatingsPersonCreatorRole", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_RatingsPersonCreatorRole_Accounts_AccountId",
|
||||||
|
column: x => x.AccountId,
|
||||||
|
principalTable: "Accounts",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_RatingsPersonCreatorRole_PersonCreatorRoles_PersonCreatorRo~",
|
||||||
|
column: x => x.PersonCreatorRoleId,
|
||||||
|
principalTable: "PersonCreatorRoles",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.InsertData(
|
||||||
|
table: "Countries",
|
||||||
|
columns: new[] { "Id", "Name" },
|
||||||
|
values: new object[,]
|
||||||
|
{
|
||||||
|
{ (short)1, "Afghanistan" },
|
||||||
|
{ (short)2, "Albania" }
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.InsertData(
|
||||||
|
table: "Genres",
|
||||||
|
columns: new[] { "Id", "Description", "Name" },
|
||||||
|
values: new object[,]
|
||||||
|
{
|
||||||
|
{ (short)1, null, "Comedy" },
|
||||||
|
{ (short)2, null, "Thriller" },
|
||||||
|
{ (short)3, null, "Horror" },
|
||||||
|
{ (short)4, null, "Action" },
|
||||||
|
{ (short)5, null, "Drama" }
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.InsertData(
|
||||||
|
table: "PersonActorRoleTypes",
|
||||||
|
columns: new[] { "Id", "Name" },
|
||||||
|
values: new object[,]
|
||||||
|
{
|
||||||
|
{ (short)1, "Actor" },
|
||||||
|
{ (short)2, "Supporting actor" },
|
||||||
|
{ (short)3, "Voice actor" }
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.InsertData(
|
||||||
|
table: "PersonCreatorRoleTypes",
|
||||||
|
columns: new[] { "Id", "Name" },
|
||||||
|
values: new object[,]
|
||||||
|
{
|
||||||
|
{ (short)1, "Director" },
|
||||||
|
{ (short)2, "Producer" },
|
||||||
|
{ (short)3, "Screenwriter" }
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_AccountProfilePictures_Id",
|
||||||
|
table: "AccountProfilePictures",
|
||||||
|
column: "Id",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Accounts_BackgroundPictureId",
|
||||||
|
table: "Accounts",
|
||||||
|
column: "BackgroundPictureId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Accounts_GenderId",
|
||||||
|
table: "Accounts",
|
||||||
|
column: "GenderId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Accounts_Id",
|
||||||
|
table: "Accounts",
|
||||||
|
column: "Id",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Accounts_ProfilePictureId",
|
||||||
|
table: "Accounts",
|
||||||
|
column: "ProfilePictureId",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Countries_Id",
|
||||||
|
table: "Countries",
|
||||||
|
column: "Id",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Genres_Id",
|
||||||
|
table: "Genres",
|
||||||
|
column: "Id",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Media_Id",
|
||||||
|
table: "Media",
|
||||||
|
column: "Id",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Media_MediaPosterImageId",
|
||||||
|
table: "Media",
|
||||||
|
column: "MediaPosterImageId",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_MediaGenres_MediaId",
|
||||||
|
table: "MediaGenres",
|
||||||
|
column: "MediaId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_MediaMovies_Id",
|
||||||
|
table: "MediaMovies",
|
||||||
|
column: "Id",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_MediaPhotoImages_Id",
|
||||||
|
table: "MediaPhotoImages",
|
||||||
|
column: "Id",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_MediaPhotoImages_MediaId",
|
||||||
|
table: "MediaPhotoImages",
|
||||||
|
column: "MediaId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_MediaPosterImages_Id",
|
||||||
|
table: "MediaPosterImages",
|
||||||
|
column: "Id",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_MediaProductionCountrys_MediaId",
|
||||||
|
table: "MediaProductionCountrys",
|
||||||
|
column: "MediaId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_MediaSeries_Id",
|
||||||
|
table: "MediaSeries",
|
||||||
|
column: "Id",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_MediaSeriesEpisodes_Id",
|
||||||
|
table: "MediaSeriesEpisodes",
|
||||||
|
column: "Id",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_MediaSeriesEpisodes_MediaSeriesSeasonId",
|
||||||
|
table: "MediaSeriesEpisodes",
|
||||||
|
column: "MediaSeriesSeasonId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_MediaSeriesSeasons_Id",
|
||||||
|
table: "MediaSeriesSeasons",
|
||||||
|
column: "Id",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_MediaSeriesSeasons_MediaSeriesId",
|
||||||
|
table: "MediaSeriesSeasons",
|
||||||
|
column: "MediaSeriesId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_PersonActorRoles_Id",
|
||||||
|
table: "PersonActorRoles",
|
||||||
|
column: "Id",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_PersonActorRoles_MediaId",
|
||||||
|
table: "PersonActorRoles",
|
||||||
|
column: "MediaId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_PersonActorRoles_PersonActorRoleTypeId",
|
||||||
|
table: "PersonActorRoles",
|
||||||
|
column: "PersonActorRoleTypeId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_PersonActorRoles_PersonId",
|
||||||
|
table: "PersonActorRoles",
|
||||||
|
column: "PersonId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_PersonActorRoleTypes_Id",
|
||||||
|
table: "PersonActorRoleTypes",
|
||||||
|
column: "Id",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_PersonCreatorRoles_Id",
|
||||||
|
table: "PersonCreatorRoles",
|
||||||
|
column: "Id",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_PersonCreatorRoles_MediaId",
|
||||||
|
table: "PersonCreatorRoles",
|
||||||
|
column: "MediaId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_PersonCreatorRoles_PersonCreatorRoleTypeId",
|
||||||
|
table: "PersonCreatorRoles",
|
||||||
|
column: "PersonCreatorRoleTypeId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_PersonCreatorRoles_PersonId",
|
||||||
|
table: "PersonCreatorRoles",
|
||||||
|
column: "PersonId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_PersonCreatorRoleTypes_Id",
|
||||||
|
table: "PersonCreatorRoleTypes",
|
||||||
|
column: "Id",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_PersonPhotoImages_Id",
|
||||||
|
table: "PersonPhotoImages",
|
||||||
|
column: "Id",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Persons_GenderId",
|
||||||
|
table: "Persons",
|
||||||
|
column: "GenderId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Persons_Id",
|
||||||
|
table: "Persons",
|
||||||
|
column: "Id",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Persons_PersonPhotoId",
|
||||||
|
table: "Persons",
|
||||||
|
column: "PersonPhotoId",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_RatingsMedia_AccountId",
|
||||||
|
table: "RatingsMedia",
|
||||||
|
column: "AccountId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_RatingsMedia_Id",
|
||||||
|
table: "RatingsMedia",
|
||||||
|
column: "Id",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_RatingsMedia_MediaId",
|
||||||
|
table: "RatingsMedia",
|
||||||
|
column: "MediaId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_RatingsMediaSeriesEpisode_AccountId",
|
||||||
|
table: "RatingsMediaSeriesEpisode",
|
||||||
|
column: "AccountId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_RatingsMediaSeriesEpisode_Id",
|
||||||
|
table: "RatingsMediaSeriesEpisode",
|
||||||
|
column: "Id",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_RatingsMediaSeriesEpisode_MediaSeriesEpisodeId",
|
||||||
|
table: "RatingsMediaSeriesEpisode",
|
||||||
|
column: "MediaSeriesEpisodeId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_RatingsMediaSeriesSeason_AccountId",
|
||||||
|
table: "RatingsMediaSeriesSeason",
|
||||||
|
column: "AccountId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_RatingsMediaSeriesSeason_Id",
|
||||||
|
table: "RatingsMediaSeriesSeason",
|
||||||
|
column: "Id",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_RatingsMediaSeriesSeason_MediaSeriesSeasonId",
|
||||||
|
table: "RatingsMediaSeriesSeason",
|
||||||
|
column: "MediaSeriesSeasonId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_RatingsPersonActorRole_AccountId",
|
||||||
|
table: "RatingsPersonActorRole",
|
||||||
|
column: "AccountId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_RatingsPersonActorRole_Id",
|
||||||
|
table: "RatingsPersonActorRole",
|
||||||
|
column: "Id",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_RatingsPersonActorRole_PersonActorRoleId",
|
||||||
|
table: "RatingsPersonActorRole",
|
||||||
|
column: "PersonActorRoleId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_RatingsPersonCreatorRole_AccountId",
|
||||||
|
table: "RatingsPersonCreatorRole",
|
||||||
|
column: "AccountId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_RatingsPersonCreatorRole_Id",
|
||||||
|
table: "RatingsPersonCreatorRole",
|
||||||
|
column: "Id",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_RatingsPersonCreatorRole_PersonCreatorRoleId",
|
||||||
|
table: "RatingsPersonCreatorRole",
|
||||||
|
column: "PersonCreatorRoleId");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "MediaGenres");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "MediaProductionCountrys");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "RatingsMedia");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "RatingsMediaSeriesEpisode");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "RatingsMediaSeriesSeason");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "RatingsPersonActorRole");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "RatingsPersonCreatorRole");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Genres");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Countries");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "MediaSeriesEpisodes");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "PersonActorRoles");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Accounts");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "PersonCreatorRoles");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "MediaSeriesSeasons");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "PersonActorRoleTypes");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "AccountProfilePictures");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "MediaPhotoImages");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "PersonCreatorRoleTypes");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Persons");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Media");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Gender");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "PersonPhotoImages");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "MediaMovies");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "MediaPosterImages");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "MediaSeries");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,8 +12,8 @@ using WatchIt.Database;
|
|||||||
namespace WatchIt.Database.Migrations
|
namespace WatchIt.Database.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(DatabaseContext))]
|
[DbContext(typeof(DatabaseContext))]
|
||||||
[Migration("20240319232340_0002_PersonActorTableAdded")]
|
[Migration("20240321165250_0001_GendersTableAdded")]
|
||||||
partial class _0002_PersonActorTableAdded
|
partial class _0001_GendersTableAdded
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
@@ -51,6 +51,9 @@ namespace WatchIt.Database.Migrations
|
|||||||
.HasMaxLength(320)
|
.HasMaxLength(320)
|
||||||
.HasColumnType("character varying(320)");
|
.HasColumnType("character varying(320)");
|
||||||
|
|
||||||
|
b.Property<short>("GenderId")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
b.Property<bool>("IsAdmin")
|
b.Property<bool>("IsAdmin")
|
||||||
.HasColumnType("boolean");
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
@@ -86,6 +89,8 @@ namespace WatchIt.Database.Migrations
|
|||||||
|
|
||||||
b.HasIndex("BackgroundPictureId");
|
b.HasIndex("BackgroundPictureId");
|
||||||
|
|
||||||
|
b.HasIndex("GenderId");
|
||||||
|
|
||||||
b.HasIndex("Id")
|
b.HasIndex("Id")
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
|
|
||||||
@@ -157,6 +162,38 @@ namespace WatchIt.Database.Migrations
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Common.Gender", b =>
|
||||||
|
{
|
||||||
|
b.Property<short>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<short>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("Id")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.ToTable("Genders");
|
||||||
|
|
||||||
|
b.HasData(
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = (short)1,
|
||||||
|
Name = "Male"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = (short)2,
|
||||||
|
Name = "Female"
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Common.Genre", b =>
|
modelBuilder.Entity("WatchIt.Database.Model.Common.Genre", b =>
|
||||||
{
|
{
|
||||||
b.Property<short>("Id")
|
b.Property<short>("Id")
|
||||||
@@ -465,6 +502,9 @@ namespace WatchIt.Database.Migrations
|
|||||||
.HasMaxLength(200)
|
.HasMaxLength(200)
|
||||||
.HasColumnType("character varying(200)");
|
.HasColumnType("character varying(200)");
|
||||||
|
|
||||||
|
b.Property<short>("GenderId")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
b.Property<string>("Name")
|
b.Property<string>("Name")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasMaxLength(100)
|
.HasMaxLength(100)
|
||||||
@@ -475,6 +515,8 @@ namespace WatchIt.Database.Migrations
|
|||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("GenderId");
|
||||||
|
|
||||||
b.HasIndex("Id")
|
b.HasIndex("Id")
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
|
|
||||||
@@ -555,6 +597,73 @@ namespace WatchIt.Database.Migrations
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Person.PersonCreatorRole", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<long>("MediaId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<short>("PersonCreatorRoleTypeId")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
b.Property<long>("PersonId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("Id")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.HasIndex("MediaId");
|
||||||
|
|
||||||
|
b.HasIndex("PersonCreatorRoleTypeId");
|
||||||
|
|
||||||
|
b.HasIndex("PersonId");
|
||||||
|
|
||||||
|
b.ToTable("PersonCreatorRoles");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Person.PersonCreatorRoleType", b =>
|
||||||
|
{
|
||||||
|
b.Property<short>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<short>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(100)
|
||||||
|
.HasColumnType("character varying(100)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("Id")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.ToTable("PersonCreatorRoleTypes");
|
||||||
|
|
||||||
|
b.HasData(
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = (short)1,
|
||||||
|
Name = "Director"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = (short)2,
|
||||||
|
Name = "Producer"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = (short)3,
|
||||||
|
Name = "Screenwriter"
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Person.PersonPhotoImage", b =>
|
modelBuilder.Entity("WatchIt.Database.Model.Person.PersonPhotoImage", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
@@ -584,18 +693,161 @@ namespace WatchIt.Database.Migrations
|
|||||||
b.ToTable("PersonPhotoImages");
|
b.ToTable("PersonPhotoImages");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingMedia", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<long>("AccountId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<long>("MediaId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<short>("Rating")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("AccountId");
|
||||||
|
|
||||||
|
b.HasIndex("Id")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.HasIndex("MediaId");
|
||||||
|
|
||||||
|
b.ToTable("RatingsMedia");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingMediaSeriesEpisode", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<long>("AccountId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<Guid>("MediaSeriesEpisodeId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<short>("Rating")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("AccountId");
|
||||||
|
|
||||||
|
b.HasIndex("Id")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.HasIndex("MediaSeriesEpisodeId");
|
||||||
|
|
||||||
|
b.ToTable("RatingsMediaSeriesEpisode");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingMediaSeriesSeason", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<long>("AccountId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<Guid>("MediaSeriesSeasonId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<short>("Rating")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("AccountId");
|
||||||
|
|
||||||
|
b.HasIndex("Id")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.HasIndex("MediaSeriesSeasonId");
|
||||||
|
|
||||||
|
b.ToTable("RatingsMediaSeriesSeason");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingPersonActorRole", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<long>("AccountId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<Guid>("PersonActorRoleId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<short>("Rating")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("AccountId");
|
||||||
|
|
||||||
|
b.HasIndex("Id")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.HasIndex("PersonActorRoleId");
|
||||||
|
|
||||||
|
b.ToTable("RatingsPersonActorRole", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingPersonCreatorRole", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<long>("AccountId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<Guid>("PersonCreatorRoleId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<short>("Rating")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("AccountId");
|
||||||
|
|
||||||
|
b.HasIndex("Id")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.HasIndex("PersonCreatorRoleId");
|
||||||
|
|
||||||
|
b.ToTable("RatingsPersonCreatorRole", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Account.Account", b =>
|
modelBuilder.Entity("WatchIt.Database.Model.Account.Account", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("WatchIt.Database.Model.Media.MediaPhotoImage", "BackgroundPicture")
|
b.HasOne("WatchIt.Database.Model.Media.MediaPhotoImage", "BackgroundPicture")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("BackgroundPictureId");
|
.HasForeignKey("BackgroundPictureId");
|
||||||
|
|
||||||
|
b.HasOne("WatchIt.Database.Model.Common.Gender", "Gender")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("GenderId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
b.HasOne("WatchIt.Database.Model.Account.AccountProfilePicture", "ProfilePicture")
|
b.HasOne("WatchIt.Database.Model.Account.AccountProfilePicture", "ProfilePicture")
|
||||||
.WithOne("Account")
|
.WithOne("Account")
|
||||||
.HasForeignKey("WatchIt.Database.Model.Account.Account", "ProfilePictureId");
|
.HasForeignKey("WatchIt.Database.Model.Account.Account", "ProfilePictureId");
|
||||||
|
|
||||||
b.Navigation("BackgroundPicture");
|
b.Navigation("BackgroundPicture");
|
||||||
|
|
||||||
|
b.Navigation("Gender");
|
||||||
|
|
||||||
b.Navigation("ProfilePicture");
|
b.Navigation("ProfilePicture");
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -693,10 +945,18 @@ namespace WatchIt.Database.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Person.Person", b =>
|
modelBuilder.Entity("WatchIt.Database.Model.Person.Person", b =>
|
||||||
{
|
{
|
||||||
|
b.HasOne("WatchIt.Database.Model.Common.Gender", "Gender")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("GenderId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
b.HasOne("WatchIt.Database.Model.Person.PersonPhotoImage", "PersonPhoto")
|
b.HasOne("WatchIt.Database.Model.Person.PersonPhotoImage", "PersonPhoto")
|
||||||
.WithOne("Person")
|
.WithOne("Person")
|
||||||
.HasForeignKey("WatchIt.Database.Model.Person.Person", "PersonPhotoId");
|
.HasForeignKey("WatchIt.Database.Model.Person.Person", "PersonPhotoId");
|
||||||
|
|
||||||
|
b.Navigation("Gender");
|
||||||
|
|
||||||
b.Navigation("PersonPhoto");
|
b.Navigation("PersonPhoto");
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -727,6 +987,141 @@ namespace WatchIt.Database.Migrations
|
|||||||
b.Navigation("PersonActorRoleType");
|
b.Navigation("PersonActorRoleType");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Person.PersonCreatorRole", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("WatchIt.Database.Model.Media.Media", "Media")
|
||||||
|
.WithMany("PersonCreatorRoles")
|
||||||
|
.HasForeignKey("MediaId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("WatchIt.Database.Model.Person.PersonCreatorRoleType", "PersonCreatorRoleType")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("PersonCreatorRoleTypeId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("WatchIt.Database.Model.Person.Person", "Person")
|
||||||
|
.WithMany("PersonCreatorRoles")
|
||||||
|
.HasForeignKey("PersonId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Media");
|
||||||
|
|
||||||
|
b.Navigation("Person");
|
||||||
|
|
||||||
|
b.Navigation("PersonCreatorRoleType");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingMedia", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("WatchIt.Database.Model.Account.Account", "Account")
|
||||||
|
.WithMany("RatingMedia")
|
||||||
|
.HasForeignKey("AccountId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("WatchIt.Database.Model.Media.Media", "Media")
|
||||||
|
.WithMany("RatingMedia")
|
||||||
|
.HasForeignKey("MediaId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Account");
|
||||||
|
|
||||||
|
b.Navigation("Media");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingMediaSeriesEpisode", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("WatchIt.Database.Model.Account.Account", "Account")
|
||||||
|
.WithMany("RatingMediaSeriesEpisode")
|
||||||
|
.HasForeignKey("AccountId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("WatchIt.Database.Model.Media.MediaSeriesEpisode", "MediaSeriesEpisode")
|
||||||
|
.WithMany("RatingMediaSeriesEpisode")
|
||||||
|
.HasForeignKey("MediaSeriesEpisodeId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Account");
|
||||||
|
|
||||||
|
b.Navigation("MediaSeriesEpisode");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingMediaSeriesSeason", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("WatchIt.Database.Model.Account.Account", "Account")
|
||||||
|
.WithMany("RatingMediaSeriesSeason")
|
||||||
|
.HasForeignKey("AccountId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("WatchIt.Database.Model.Media.MediaSeriesSeason", "MediaSeriesSeason")
|
||||||
|
.WithMany("RatingMediaSeriesSeason")
|
||||||
|
.HasForeignKey("MediaSeriesSeasonId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Account");
|
||||||
|
|
||||||
|
b.Navigation("MediaSeriesSeason");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingPersonActorRole", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("WatchIt.Database.Model.Account.Account", "Account")
|
||||||
|
.WithMany("RatingPersonActorRole")
|
||||||
|
.HasForeignKey("AccountId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("WatchIt.Database.Model.Person.PersonActorRole", "PersonActorRole")
|
||||||
|
.WithMany("RatingPersonActorRole")
|
||||||
|
.HasForeignKey("PersonActorRoleId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Account");
|
||||||
|
|
||||||
|
b.Navigation("PersonActorRole");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingPersonCreatorRole", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("WatchIt.Database.Model.Account.Account", "Account")
|
||||||
|
.WithMany("RatingPersonCreatorRole")
|
||||||
|
.HasForeignKey("AccountId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("WatchIt.Database.Model.Person.PersonCreatorRole", "PersonCreatorRole")
|
||||||
|
.WithMany("RatingPersonCreatorRole")
|
||||||
|
.HasForeignKey("PersonCreatorRoleId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Account");
|
||||||
|
|
||||||
|
b.Navigation("PersonCreatorRole");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Account.Account", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("RatingMedia");
|
||||||
|
|
||||||
|
b.Navigation("RatingMediaSeriesEpisode");
|
||||||
|
|
||||||
|
b.Navigation("RatingMediaSeriesSeason");
|
||||||
|
|
||||||
|
b.Navigation("RatingPersonActorRole");
|
||||||
|
|
||||||
|
b.Navigation("RatingPersonCreatorRole");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Account.AccountProfilePicture", b =>
|
modelBuilder.Entity("WatchIt.Database.Model.Account.AccountProfilePicture", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("Account")
|
b.Navigation("Account")
|
||||||
@@ -752,6 +1147,10 @@ namespace WatchIt.Database.Migrations
|
|||||||
b.Navigation("MediaProductionCountries");
|
b.Navigation("MediaProductionCountries");
|
||||||
|
|
||||||
b.Navigation("PersonActorRoles");
|
b.Navigation("PersonActorRoles");
|
||||||
|
|
||||||
|
b.Navigation("PersonCreatorRoles");
|
||||||
|
|
||||||
|
b.Navigation("RatingMedia");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaMovie", b =>
|
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaMovie", b =>
|
||||||
@@ -774,14 +1173,33 @@ namespace WatchIt.Database.Migrations
|
|||||||
b.Navigation("MediaSeriesSeasons");
|
b.Navigation("MediaSeriesSeasons");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeriesEpisode", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("RatingMediaSeriesEpisode");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeriesSeason", b =>
|
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeriesSeason", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("MediaSeriesEpisodes");
|
b.Navigation("MediaSeriesEpisodes");
|
||||||
|
|
||||||
|
b.Navigation("RatingMediaSeriesSeason");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Person.Person", b =>
|
modelBuilder.Entity("WatchIt.Database.Model.Person.Person", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("PersonActorRoles");
|
b.Navigation("PersonActorRoles");
|
||||||
|
|
||||||
|
b.Navigation("PersonCreatorRoles");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Person.PersonActorRole", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("RatingPersonActorRole");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Person.PersonCreatorRole", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("RatingPersonCreatorRole");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Person.PersonPhotoImage", b =>
|
modelBuilder.Entity("WatchIt.Database.Model.Person.PersonPhotoImage", b =>
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class _0001_GendersTableAdded : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_Accounts_Gender_GenderId",
|
||||||
|
table: "Accounts");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_Persons_Gender_GenderId",
|
||||||
|
table: "Persons");
|
||||||
|
|
||||||
|
migrationBuilder.DropPrimaryKey(
|
||||||
|
name: "PK_Gender",
|
||||||
|
table: "Gender");
|
||||||
|
|
||||||
|
migrationBuilder.RenameTable(
|
||||||
|
name: "Gender",
|
||||||
|
newName: "Genders");
|
||||||
|
|
||||||
|
migrationBuilder.AddPrimaryKey(
|
||||||
|
name: "PK_Genders",
|
||||||
|
table: "Genders",
|
||||||
|
column: "Id");
|
||||||
|
|
||||||
|
migrationBuilder.InsertData(
|
||||||
|
table: "Genders",
|
||||||
|
columns: new[] { "Id", "Name" },
|
||||||
|
values: new object[,]
|
||||||
|
{
|
||||||
|
{ (short)1, "Male" },
|
||||||
|
{ (short)2, "Female" }
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Genders_Id",
|
||||||
|
table: "Genders",
|
||||||
|
column: "Id",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Accounts_Genders_GenderId",
|
||||||
|
table: "Accounts",
|
||||||
|
column: "GenderId",
|
||||||
|
principalTable: "Genders",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Persons_Genders_GenderId",
|
||||||
|
table: "Persons",
|
||||||
|
column: "GenderId",
|
||||||
|
principalTable: "Genders",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_Accounts_Genders_GenderId",
|
||||||
|
table: "Accounts");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_Persons_Genders_GenderId",
|
||||||
|
table: "Persons");
|
||||||
|
|
||||||
|
migrationBuilder.DropPrimaryKey(
|
||||||
|
name: "PK_Genders",
|
||||||
|
table: "Genders");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_Genders_Id",
|
||||||
|
table: "Genders");
|
||||||
|
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "Genders",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: (short)1);
|
||||||
|
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "Genders",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: (short)2);
|
||||||
|
|
||||||
|
migrationBuilder.RenameTable(
|
||||||
|
name: "Genders",
|
||||||
|
newName: "Gender");
|
||||||
|
|
||||||
|
migrationBuilder.AddPrimaryKey(
|
||||||
|
name: "PK_Gender",
|
||||||
|
table: "Gender",
|
||||||
|
column: "Id");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Accounts_Gender_GenderId",
|
||||||
|
table: "Accounts",
|
||||||
|
column: "GenderId",
|
||||||
|
principalTable: "Gender",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Persons_Gender_GenderId",
|
||||||
|
table: "Persons",
|
||||||
|
column: "GenderId",
|
||||||
|
principalTable: "Gender",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,8 +12,8 @@ using WatchIt.Database;
|
|||||||
namespace WatchIt.Database.Migrations
|
namespace WatchIt.Database.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(DatabaseContext))]
|
[DbContext(typeof(DatabaseContext))]
|
||||||
[Migration("20240319225625_0001_PersonTableAdded")]
|
[Migration("20240321171215_0002_ViewCountTablesAdded")]
|
||||||
partial class _0001_PersonTableAdded
|
partial class _0002_ViewCountTablesAdded
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
@@ -51,6 +51,9 @@ namespace WatchIt.Database.Migrations
|
|||||||
.HasMaxLength(320)
|
.HasMaxLength(320)
|
||||||
.HasColumnType("character varying(320)");
|
.HasColumnType("character varying(320)");
|
||||||
|
|
||||||
|
b.Property<short>("GenderId")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
b.Property<bool>("IsAdmin")
|
b.Property<bool>("IsAdmin")
|
||||||
.HasColumnType("boolean");
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
@@ -86,6 +89,8 @@ namespace WatchIt.Database.Migrations
|
|||||||
|
|
||||||
b.HasIndex("BackgroundPictureId");
|
b.HasIndex("BackgroundPictureId");
|
||||||
|
|
||||||
|
b.HasIndex("GenderId");
|
||||||
|
|
||||||
b.HasIndex("Id")
|
b.HasIndex("Id")
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
|
|
||||||
@@ -157,6 +162,38 @@ namespace WatchIt.Database.Migrations
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Common.Gender", b =>
|
||||||
|
{
|
||||||
|
b.Property<short>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<short>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("Id")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.ToTable("Genders");
|
||||||
|
|
||||||
|
b.HasData(
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = (short)1,
|
||||||
|
Name = "Male"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = (short)2,
|
||||||
|
Name = "Female"
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Common.Genre", b =>
|
modelBuilder.Entity("WatchIt.Database.Model.Common.Genre", b =>
|
||||||
{
|
{
|
||||||
b.Property<short>("Id")
|
b.Property<short>("Id")
|
||||||
@@ -465,6 +502,9 @@ namespace WatchIt.Database.Migrations
|
|||||||
.HasMaxLength(200)
|
.HasMaxLength(200)
|
||||||
.HasColumnType("character varying(200)");
|
.HasColumnType("character varying(200)");
|
||||||
|
|
||||||
|
b.Property<short>("GenderId")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
b.Property<string>("Name")
|
b.Property<string>("Name")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasMaxLength(100)
|
.HasMaxLength(100)
|
||||||
@@ -475,6 +515,8 @@ namespace WatchIt.Database.Migrations
|
|||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("GenderId");
|
||||||
|
|
||||||
b.HasIndex("Id")
|
b.HasIndex("Id")
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
|
|
||||||
@@ -484,6 +526,144 @@ namespace WatchIt.Database.Migrations
|
|||||||
b.ToTable("Persons");
|
b.ToTable("Persons");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Person.PersonActorRole", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<long>("MediaId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<short>("PersonActorRoleTypeId")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
b.Property<long>("PersonId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<string>("RoleName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("Id")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.HasIndex("MediaId");
|
||||||
|
|
||||||
|
b.HasIndex("PersonActorRoleTypeId");
|
||||||
|
|
||||||
|
b.HasIndex("PersonId");
|
||||||
|
|
||||||
|
b.ToTable("PersonActorRoles");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Person.PersonActorRoleType", b =>
|
||||||
|
{
|
||||||
|
b.Property<short>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<short>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(100)
|
||||||
|
.HasColumnType("character varying(100)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("Id")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.ToTable("PersonActorRoleTypes");
|
||||||
|
|
||||||
|
b.HasData(
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = (short)1,
|
||||||
|
Name = "Actor"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = (short)2,
|
||||||
|
Name = "Supporting actor"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = (short)3,
|
||||||
|
Name = "Voice actor"
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Person.PersonCreatorRole", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<long>("MediaId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<short>("PersonCreatorRoleTypeId")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
b.Property<long>("PersonId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("Id")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.HasIndex("MediaId");
|
||||||
|
|
||||||
|
b.HasIndex("PersonCreatorRoleTypeId");
|
||||||
|
|
||||||
|
b.HasIndex("PersonId");
|
||||||
|
|
||||||
|
b.ToTable("PersonCreatorRoles");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Person.PersonCreatorRoleType", b =>
|
||||||
|
{
|
||||||
|
b.Property<short>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<short>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(100)
|
||||||
|
.HasColumnType("character varying(100)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("Id")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.ToTable("PersonCreatorRoleTypes");
|
||||||
|
|
||||||
|
b.HasData(
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = (short)1,
|
||||||
|
Name = "Director"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = (short)2,
|
||||||
|
Name = "Producer"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = (short)3,
|
||||||
|
Name = "Screenwriter"
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Person.PersonPhotoImage", b =>
|
modelBuilder.Entity("WatchIt.Database.Model.Person.PersonPhotoImage", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
@@ -513,18 +693,219 @@ namespace WatchIt.Database.Migrations
|
|||||||
b.ToTable("PersonPhotoImages");
|
b.ToTable("PersonPhotoImages");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingMedia", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<long>("AccountId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<long>("MediaId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<short>("Rating")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("AccountId");
|
||||||
|
|
||||||
|
b.HasIndex("Id")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.HasIndex("MediaId");
|
||||||
|
|
||||||
|
b.ToTable("RatingsMedia");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingMediaSeriesEpisode", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<long>("AccountId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<Guid>("MediaSeriesEpisodeId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<short>("Rating")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("AccountId");
|
||||||
|
|
||||||
|
b.HasIndex("Id")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.HasIndex("MediaSeriesEpisodeId");
|
||||||
|
|
||||||
|
b.ToTable("RatingsMediaSeriesEpisode");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingMediaSeriesSeason", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<long>("AccountId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<Guid>("MediaSeriesSeasonId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<short>("Rating")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("AccountId");
|
||||||
|
|
||||||
|
b.HasIndex("Id")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.HasIndex("MediaSeriesSeasonId");
|
||||||
|
|
||||||
|
b.ToTable("RatingsMediaSeriesSeason");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingPersonActorRole", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<long>("AccountId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<Guid>("PersonActorRoleId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<short>("Rating")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("AccountId");
|
||||||
|
|
||||||
|
b.HasIndex("Id")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.HasIndex("PersonActorRoleId");
|
||||||
|
|
||||||
|
b.ToTable("RatingsPersonActorRole", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingPersonCreatorRole", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<long>("AccountId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<Guid>("PersonCreatorRoleId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<short>("Rating")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("AccountId");
|
||||||
|
|
||||||
|
b.HasIndex("Id")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.HasIndex("PersonCreatorRoleId");
|
||||||
|
|
||||||
|
b.ToTable("RatingsPersonCreatorRole", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.ViewCount.ViewCountMedia", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<DateOnly>("Date")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("date")
|
||||||
|
.HasDefaultValueSql("now()");
|
||||||
|
|
||||||
|
b.Property<long>("MediaId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<long>("ViewCount")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("bigint")
|
||||||
|
.HasDefaultValue(0L);
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("Id")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.HasIndex("MediaId");
|
||||||
|
|
||||||
|
b.ToTable("ViewCountsMedia", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.ViewCount.ViewCountPerson", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<DateOnly>("Date")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("date")
|
||||||
|
.HasDefaultValueSql("now()");
|
||||||
|
|
||||||
|
b.Property<long>("PersonId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<long>("ViewCount")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("bigint")
|
||||||
|
.HasDefaultValue(0L);
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("Id")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.HasIndex("PersonId");
|
||||||
|
|
||||||
|
b.ToTable("ViewCountsPerson", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Account.Account", b =>
|
modelBuilder.Entity("WatchIt.Database.Model.Account.Account", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("WatchIt.Database.Model.Media.MediaPhotoImage", "BackgroundPicture")
|
b.HasOne("WatchIt.Database.Model.Media.MediaPhotoImage", "BackgroundPicture")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("BackgroundPictureId");
|
.HasForeignKey("BackgroundPictureId");
|
||||||
|
|
||||||
|
b.HasOne("WatchIt.Database.Model.Common.Gender", "Gender")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("GenderId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
b.HasOne("WatchIt.Database.Model.Account.AccountProfilePicture", "ProfilePicture")
|
b.HasOne("WatchIt.Database.Model.Account.AccountProfilePicture", "ProfilePicture")
|
||||||
.WithOne("Account")
|
.WithOne("Account")
|
||||||
.HasForeignKey("WatchIt.Database.Model.Account.Account", "ProfilePictureId");
|
.HasForeignKey("WatchIt.Database.Model.Account.Account", "ProfilePictureId");
|
||||||
|
|
||||||
b.Navigation("BackgroundPicture");
|
b.Navigation("BackgroundPicture");
|
||||||
|
|
||||||
|
b.Navigation("Gender");
|
||||||
|
|
||||||
b.Navigation("ProfilePicture");
|
b.Navigation("ProfilePicture");
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -622,13 +1003,205 @@ namespace WatchIt.Database.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Person.Person", b =>
|
modelBuilder.Entity("WatchIt.Database.Model.Person.Person", b =>
|
||||||
{
|
{
|
||||||
|
b.HasOne("WatchIt.Database.Model.Common.Gender", "Gender")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("GenderId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
b.HasOne("WatchIt.Database.Model.Person.PersonPhotoImage", "PersonPhoto")
|
b.HasOne("WatchIt.Database.Model.Person.PersonPhotoImage", "PersonPhoto")
|
||||||
.WithOne("Person")
|
.WithOne("Person")
|
||||||
.HasForeignKey("WatchIt.Database.Model.Person.Person", "PersonPhotoId");
|
.HasForeignKey("WatchIt.Database.Model.Person.Person", "PersonPhotoId");
|
||||||
|
|
||||||
|
b.Navigation("Gender");
|
||||||
|
|
||||||
b.Navigation("PersonPhoto");
|
b.Navigation("PersonPhoto");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Person.PersonActorRole", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("WatchIt.Database.Model.Media.Media", "Media")
|
||||||
|
.WithMany("PersonActorRoles")
|
||||||
|
.HasForeignKey("MediaId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("WatchIt.Database.Model.Person.PersonActorRoleType", "PersonActorRoleType")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("PersonActorRoleTypeId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("WatchIt.Database.Model.Person.Person", "Person")
|
||||||
|
.WithMany("PersonActorRoles")
|
||||||
|
.HasForeignKey("PersonId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Media");
|
||||||
|
|
||||||
|
b.Navigation("Person");
|
||||||
|
|
||||||
|
b.Navigation("PersonActorRoleType");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Person.PersonCreatorRole", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("WatchIt.Database.Model.Media.Media", "Media")
|
||||||
|
.WithMany("PersonCreatorRoles")
|
||||||
|
.HasForeignKey("MediaId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("WatchIt.Database.Model.Person.PersonCreatorRoleType", "PersonCreatorRoleType")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("PersonCreatorRoleTypeId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("WatchIt.Database.Model.Person.Person", "Person")
|
||||||
|
.WithMany("PersonCreatorRoles")
|
||||||
|
.HasForeignKey("PersonId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Media");
|
||||||
|
|
||||||
|
b.Navigation("Person");
|
||||||
|
|
||||||
|
b.Navigation("PersonCreatorRoleType");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingMedia", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("WatchIt.Database.Model.Account.Account", "Account")
|
||||||
|
.WithMany("RatingMedia")
|
||||||
|
.HasForeignKey("AccountId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("WatchIt.Database.Model.Media.Media", "Media")
|
||||||
|
.WithMany("RatingMedia")
|
||||||
|
.HasForeignKey("MediaId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Account");
|
||||||
|
|
||||||
|
b.Navigation("Media");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingMediaSeriesEpisode", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("WatchIt.Database.Model.Account.Account", "Account")
|
||||||
|
.WithMany("RatingMediaSeriesEpisode")
|
||||||
|
.HasForeignKey("AccountId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("WatchIt.Database.Model.Media.MediaSeriesEpisode", "MediaSeriesEpisode")
|
||||||
|
.WithMany("RatingMediaSeriesEpisode")
|
||||||
|
.HasForeignKey("MediaSeriesEpisodeId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Account");
|
||||||
|
|
||||||
|
b.Navigation("MediaSeriesEpisode");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingMediaSeriesSeason", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("WatchIt.Database.Model.Account.Account", "Account")
|
||||||
|
.WithMany("RatingMediaSeriesSeason")
|
||||||
|
.HasForeignKey("AccountId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("WatchIt.Database.Model.Media.MediaSeriesSeason", "MediaSeriesSeason")
|
||||||
|
.WithMany("RatingMediaSeriesSeason")
|
||||||
|
.HasForeignKey("MediaSeriesSeasonId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Account");
|
||||||
|
|
||||||
|
b.Navigation("MediaSeriesSeason");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingPersonActorRole", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("WatchIt.Database.Model.Account.Account", "Account")
|
||||||
|
.WithMany("RatingPersonActorRole")
|
||||||
|
.HasForeignKey("AccountId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("WatchIt.Database.Model.Person.PersonActorRole", "PersonActorRole")
|
||||||
|
.WithMany("RatingPersonActorRole")
|
||||||
|
.HasForeignKey("PersonActorRoleId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Account");
|
||||||
|
|
||||||
|
b.Navigation("PersonActorRole");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingPersonCreatorRole", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("WatchIt.Database.Model.Account.Account", "Account")
|
||||||
|
.WithMany("RatingPersonCreatorRole")
|
||||||
|
.HasForeignKey("AccountId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("WatchIt.Database.Model.Person.PersonCreatorRole", "PersonCreatorRole")
|
||||||
|
.WithMany("RatingPersonCreatorRole")
|
||||||
|
.HasForeignKey("PersonCreatorRoleId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Account");
|
||||||
|
|
||||||
|
b.Navigation("PersonCreatorRole");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.ViewCount.ViewCountMedia", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("WatchIt.Database.Model.Media.Media", "Media")
|
||||||
|
.WithMany("ViewCountsMedia")
|
||||||
|
.HasForeignKey("MediaId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Media");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.ViewCount.ViewCountPerson", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("WatchIt.Database.Model.Person.Person", "Person")
|
||||||
|
.WithMany("ViewCountsPerson")
|
||||||
|
.HasForeignKey("PersonId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Person");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Account.Account", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("RatingMedia");
|
||||||
|
|
||||||
|
b.Navigation("RatingMediaSeriesEpisode");
|
||||||
|
|
||||||
|
b.Navigation("RatingMediaSeriesSeason");
|
||||||
|
|
||||||
|
b.Navigation("RatingPersonActorRole");
|
||||||
|
|
||||||
|
b.Navigation("RatingPersonCreatorRole");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Account.AccountProfilePicture", b =>
|
modelBuilder.Entity("WatchIt.Database.Model.Account.AccountProfilePicture", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("Account")
|
b.Navigation("Account")
|
||||||
@@ -652,6 +1225,14 @@ namespace WatchIt.Database.Migrations
|
|||||||
b.Navigation("MediaPhotoImages");
|
b.Navigation("MediaPhotoImages");
|
||||||
|
|
||||||
b.Navigation("MediaProductionCountries");
|
b.Navigation("MediaProductionCountries");
|
||||||
|
|
||||||
|
b.Navigation("PersonActorRoles");
|
||||||
|
|
||||||
|
b.Navigation("PersonCreatorRoles");
|
||||||
|
|
||||||
|
b.Navigation("RatingMedia");
|
||||||
|
|
||||||
|
b.Navigation("ViewCountsMedia");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaMovie", b =>
|
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaMovie", b =>
|
||||||
@@ -674,9 +1255,35 @@ namespace WatchIt.Database.Migrations
|
|||||||
b.Navigation("MediaSeriesSeasons");
|
b.Navigation("MediaSeriesSeasons");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeriesEpisode", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("RatingMediaSeriesEpisode");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeriesSeason", b =>
|
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeriesSeason", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("MediaSeriesEpisodes");
|
b.Navigation("MediaSeriesEpisodes");
|
||||||
|
|
||||||
|
b.Navigation("RatingMediaSeriesSeason");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Person.Person", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("PersonActorRoles");
|
||||||
|
|
||||||
|
b.Navigation("PersonCreatorRoles");
|
||||||
|
|
||||||
|
b.Navigation("ViewCountsPerson");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Person.PersonActorRole", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("RatingPersonActorRole");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Person.PersonCreatorRole", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("RatingPersonCreatorRole");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Person.PersonPhotoImage", b =>
|
modelBuilder.Entity("WatchIt.Database.Model.Person.PersonPhotoImage", b =>
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class _0002_ViewCountTablesAdded : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "ViewCountsMedia",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
MediaId = table.Column<long>(type: "bigint", nullable: false),
|
||||||
|
Date = table.Column<DateOnly>(type: "date", nullable: false, defaultValueSql: "now()"),
|
||||||
|
ViewCount = table.Column<long>(type: "bigint", nullable: false, defaultValue: 0L)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_ViewCountsMedia", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_ViewCountsMedia_Media_MediaId",
|
||||||
|
column: x => x.MediaId,
|
||||||
|
principalTable: "Media",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "ViewCountsPerson",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
PersonId = table.Column<long>(type: "bigint", nullable: false),
|
||||||
|
Date = table.Column<DateOnly>(type: "date", nullable: false, defaultValueSql: "now()"),
|
||||||
|
ViewCount = table.Column<long>(type: "bigint", nullable: false, defaultValue: 0L)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_ViewCountsPerson", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_ViewCountsPerson_Persons_PersonId",
|
||||||
|
column: x => x.PersonId,
|
||||||
|
principalTable: "Persons",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_ViewCountsMedia_Id",
|
||||||
|
table: "ViewCountsMedia",
|
||||||
|
column: "Id",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_ViewCountsMedia_MediaId",
|
||||||
|
table: "ViewCountsMedia",
|
||||||
|
column: "MediaId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_ViewCountsPerson_Id",
|
||||||
|
table: "ViewCountsPerson",
|
||||||
|
column: "Id",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_ViewCountsPerson_PersonId",
|
||||||
|
table: "ViewCountsPerson",
|
||||||
|
column: "PersonId");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "ViewCountsMedia");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "ViewCountsPerson");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -48,6 +48,9 @@ namespace WatchIt.Database.Migrations
|
|||||||
.HasMaxLength(320)
|
.HasMaxLength(320)
|
||||||
.HasColumnType("character varying(320)");
|
.HasColumnType("character varying(320)");
|
||||||
|
|
||||||
|
b.Property<short>("GenderId")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
b.Property<bool>("IsAdmin")
|
b.Property<bool>("IsAdmin")
|
||||||
.HasColumnType("boolean");
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
@@ -83,6 +86,8 @@ namespace WatchIt.Database.Migrations
|
|||||||
|
|
||||||
b.HasIndex("BackgroundPictureId");
|
b.HasIndex("BackgroundPictureId");
|
||||||
|
|
||||||
|
b.HasIndex("GenderId");
|
||||||
|
|
||||||
b.HasIndex("Id")
|
b.HasIndex("Id")
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
|
|
||||||
@@ -154,6 +159,38 @@ namespace WatchIt.Database.Migrations
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Common.Gender", b =>
|
||||||
|
{
|
||||||
|
b.Property<short>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<short>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("Id")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.ToTable("Genders");
|
||||||
|
|
||||||
|
b.HasData(
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = (short)1,
|
||||||
|
Name = "Male"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = (short)2,
|
||||||
|
Name = "Female"
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Common.Genre", b =>
|
modelBuilder.Entity("WatchIt.Database.Model.Common.Genre", b =>
|
||||||
{
|
{
|
||||||
b.Property<short>("Id")
|
b.Property<short>("Id")
|
||||||
@@ -462,6 +499,9 @@ namespace WatchIt.Database.Migrations
|
|||||||
.HasMaxLength(200)
|
.HasMaxLength(200)
|
||||||
.HasColumnType("character varying(200)");
|
.HasColumnType("character varying(200)");
|
||||||
|
|
||||||
|
b.Property<short>("GenderId")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
b.Property<string>("Name")
|
b.Property<string>("Name")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasMaxLength(100)
|
.HasMaxLength(100)
|
||||||
@@ -472,6 +512,8 @@ namespace WatchIt.Database.Migrations
|
|||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("GenderId");
|
||||||
|
|
||||||
b.HasIndex("Id")
|
b.HasIndex("Id")
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
|
|
||||||
@@ -648,18 +690,219 @@ namespace WatchIt.Database.Migrations
|
|||||||
b.ToTable("PersonPhotoImages");
|
b.ToTable("PersonPhotoImages");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingMedia", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<long>("AccountId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<long>("MediaId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<short>("Rating")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("AccountId");
|
||||||
|
|
||||||
|
b.HasIndex("Id")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.HasIndex("MediaId");
|
||||||
|
|
||||||
|
b.ToTable("RatingsMedia");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingMediaSeriesEpisode", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<long>("AccountId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<Guid>("MediaSeriesEpisodeId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<short>("Rating")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("AccountId");
|
||||||
|
|
||||||
|
b.HasIndex("Id")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.HasIndex("MediaSeriesEpisodeId");
|
||||||
|
|
||||||
|
b.ToTable("RatingsMediaSeriesEpisode");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingMediaSeriesSeason", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<long>("AccountId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<Guid>("MediaSeriesSeasonId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<short>("Rating")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("AccountId");
|
||||||
|
|
||||||
|
b.HasIndex("Id")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.HasIndex("MediaSeriesSeasonId");
|
||||||
|
|
||||||
|
b.ToTable("RatingsMediaSeriesSeason");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingPersonActorRole", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<long>("AccountId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<Guid>("PersonActorRoleId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<short>("Rating")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("AccountId");
|
||||||
|
|
||||||
|
b.HasIndex("Id")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.HasIndex("PersonActorRoleId");
|
||||||
|
|
||||||
|
b.ToTable("RatingsPersonActorRole", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingPersonCreatorRole", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<long>("AccountId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<Guid>("PersonCreatorRoleId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<short>("Rating")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("AccountId");
|
||||||
|
|
||||||
|
b.HasIndex("Id")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.HasIndex("PersonCreatorRoleId");
|
||||||
|
|
||||||
|
b.ToTable("RatingsPersonCreatorRole", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.ViewCount.ViewCountMedia", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<DateOnly>("Date")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("date")
|
||||||
|
.HasDefaultValueSql("now()");
|
||||||
|
|
||||||
|
b.Property<long>("MediaId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<long>("ViewCount")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("bigint")
|
||||||
|
.HasDefaultValue(0L);
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("Id")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.HasIndex("MediaId");
|
||||||
|
|
||||||
|
b.ToTable("ViewCountsMedia", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.ViewCount.ViewCountPerson", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<DateOnly>("Date")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("date")
|
||||||
|
.HasDefaultValueSql("now()");
|
||||||
|
|
||||||
|
b.Property<long>("PersonId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<long>("ViewCount")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("bigint")
|
||||||
|
.HasDefaultValue(0L);
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("Id")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.HasIndex("PersonId");
|
||||||
|
|
||||||
|
b.ToTable("ViewCountsPerson", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Account.Account", b =>
|
modelBuilder.Entity("WatchIt.Database.Model.Account.Account", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("WatchIt.Database.Model.Media.MediaPhotoImage", "BackgroundPicture")
|
b.HasOne("WatchIt.Database.Model.Media.MediaPhotoImage", "BackgroundPicture")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("BackgroundPictureId");
|
.HasForeignKey("BackgroundPictureId");
|
||||||
|
|
||||||
|
b.HasOne("WatchIt.Database.Model.Common.Gender", "Gender")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("GenderId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
b.HasOne("WatchIt.Database.Model.Account.AccountProfilePicture", "ProfilePicture")
|
b.HasOne("WatchIt.Database.Model.Account.AccountProfilePicture", "ProfilePicture")
|
||||||
.WithOne("Account")
|
.WithOne("Account")
|
||||||
.HasForeignKey("WatchIt.Database.Model.Account.Account", "ProfilePictureId");
|
.HasForeignKey("WatchIt.Database.Model.Account.Account", "ProfilePictureId");
|
||||||
|
|
||||||
b.Navigation("BackgroundPicture");
|
b.Navigation("BackgroundPicture");
|
||||||
|
|
||||||
|
b.Navigation("Gender");
|
||||||
|
|
||||||
b.Navigation("ProfilePicture");
|
b.Navigation("ProfilePicture");
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -757,10 +1000,18 @@ namespace WatchIt.Database.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Person.Person", b =>
|
modelBuilder.Entity("WatchIt.Database.Model.Person.Person", b =>
|
||||||
{
|
{
|
||||||
|
b.HasOne("WatchIt.Database.Model.Common.Gender", "Gender")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("GenderId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
b.HasOne("WatchIt.Database.Model.Person.PersonPhotoImage", "PersonPhoto")
|
b.HasOne("WatchIt.Database.Model.Person.PersonPhotoImage", "PersonPhoto")
|
||||||
.WithOne("Person")
|
.WithOne("Person")
|
||||||
.HasForeignKey("WatchIt.Database.Model.Person.Person", "PersonPhotoId");
|
.HasForeignKey("WatchIt.Database.Model.Person.Person", "PersonPhotoId");
|
||||||
|
|
||||||
|
b.Navigation("Gender");
|
||||||
|
|
||||||
b.Navigation("PersonPhoto");
|
b.Navigation("PersonPhoto");
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -818,6 +1069,136 @@ namespace WatchIt.Database.Migrations
|
|||||||
b.Navigation("PersonCreatorRoleType");
|
b.Navigation("PersonCreatorRoleType");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingMedia", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("WatchIt.Database.Model.Account.Account", "Account")
|
||||||
|
.WithMany("RatingMedia")
|
||||||
|
.HasForeignKey("AccountId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("WatchIt.Database.Model.Media.Media", "Media")
|
||||||
|
.WithMany("RatingMedia")
|
||||||
|
.HasForeignKey("MediaId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Account");
|
||||||
|
|
||||||
|
b.Navigation("Media");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingMediaSeriesEpisode", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("WatchIt.Database.Model.Account.Account", "Account")
|
||||||
|
.WithMany("RatingMediaSeriesEpisode")
|
||||||
|
.HasForeignKey("AccountId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("WatchIt.Database.Model.Media.MediaSeriesEpisode", "MediaSeriesEpisode")
|
||||||
|
.WithMany("RatingMediaSeriesEpisode")
|
||||||
|
.HasForeignKey("MediaSeriesEpisodeId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Account");
|
||||||
|
|
||||||
|
b.Navigation("MediaSeriesEpisode");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingMediaSeriesSeason", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("WatchIt.Database.Model.Account.Account", "Account")
|
||||||
|
.WithMany("RatingMediaSeriesSeason")
|
||||||
|
.HasForeignKey("AccountId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("WatchIt.Database.Model.Media.MediaSeriesSeason", "MediaSeriesSeason")
|
||||||
|
.WithMany("RatingMediaSeriesSeason")
|
||||||
|
.HasForeignKey("MediaSeriesSeasonId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Account");
|
||||||
|
|
||||||
|
b.Navigation("MediaSeriesSeason");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingPersonActorRole", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("WatchIt.Database.Model.Account.Account", "Account")
|
||||||
|
.WithMany("RatingPersonActorRole")
|
||||||
|
.HasForeignKey("AccountId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("WatchIt.Database.Model.Person.PersonActorRole", "PersonActorRole")
|
||||||
|
.WithMany("RatingPersonActorRole")
|
||||||
|
.HasForeignKey("PersonActorRoleId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Account");
|
||||||
|
|
||||||
|
b.Navigation("PersonActorRole");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingPersonCreatorRole", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("WatchIt.Database.Model.Account.Account", "Account")
|
||||||
|
.WithMany("RatingPersonCreatorRole")
|
||||||
|
.HasForeignKey("AccountId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("WatchIt.Database.Model.Person.PersonCreatorRole", "PersonCreatorRole")
|
||||||
|
.WithMany("RatingPersonCreatorRole")
|
||||||
|
.HasForeignKey("PersonCreatorRoleId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Account");
|
||||||
|
|
||||||
|
b.Navigation("PersonCreatorRole");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.ViewCount.ViewCountMedia", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("WatchIt.Database.Model.Media.Media", "Media")
|
||||||
|
.WithMany("ViewCountsMedia")
|
||||||
|
.HasForeignKey("MediaId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Media");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.ViewCount.ViewCountPerson", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("WatchIt.Database.Model.Person.Person", "Person")
|
||||||
|
.WithMany("ViewCountsPerson")
|
||||||
|
.HasForeignKey("PersonId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Person");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Account.Account", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("RatingMedia");
|
||||||
|
|
||||||
|
b.Navigation("RatingMediaSeriesEpisode");
|
||||||
|
|
||||||
|
b.Navigation("RatingMediaSeriesSeason");
|
||||||
|
|
||||||
|
b.Navigation("RatingPersonActorRole");
|
||||||
|
|
||||||
|
b.Navigation("RatingPersonCreatorRole");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Account.AccountProfilePicture", b =>
|
modelBuilder.Entity("WatchIt.Database.Model.Account.AccountProfilePicture", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("Account")
|
b.Navigation("Account")
|
||||||
@@ -845,6 +1226,10 @@ namespace WatchIt.Database.Migrations
|
|||||||
b.Navigation("PersonActorRoles");
|
b.Navigation("PersonActorRoles");
|
||||||
|
|
||||||
b.Navigation("PersonCreatorRoles");
|
b.Navigation("PersonCreatorRoles");
|
||||||
|
|
||||||
|
b.Navigation("RatingMedia");
|
||||||
|
|
||||||
|
b.Navigation("ViewCountsMedia");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaMovie", b =>
|
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaMovie", b =>
|
||||||
@@ -867,9 +1252,16 @@ namespace WatchIt.Database.Migrations
|
|||||||
b.Navigation("MediaSeriesSeasons");
|
b.Navigation("MediaSeriesSeasons");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeriesEpisode", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("RatingMediaSeriesEpisode");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeriesSeason", b =>
|
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeriesSeason", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("MediaSeriesEpisodes");
|
b.Navigation("MediaSeriesEpisodes");
|
||||||
|
|
||||||
|
b.Navigation("RatingMediaSeriesSeason");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Person.Person", b =>
|
modelBuilder.Entity("WatchIt.Database.Model.Person.Person", b =>
|
||||||
@@ -877,6 +1269,18 @@ namespace WatchIt.Database.Migrations
|
|||||||
b.Navigation("PersonActorRoles");
|
b.Navigation("PersonActorRoles");
|
||||||
|
|
||||||
b.Navigation("PersonCreatorRoles");
|
b.Navigation("PersonCreatorRoles");
|
||||||
|
|
||||||
|
b.Navigation("ViewCountsPerson");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Person.PersonActorRole", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("RatingPersonActorRole");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WatchIt.Database.Model.Person.PersonCreatorRole", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("RatingPersonCreatorRole");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WatchIt.Database.Model.Person.PersonPhotoImage", b =>
|
modelBuilder.Entity("WatchIt.Database.Model.Person.PersonPhotoImage", b =>
|
||||||
|
|||||||
@@ -7,6 +7,6 @@
|
|||||||
},
|
},
|
||||||
"AllowedHosts": "*",
|
"AllowedHosts": "*",
|
||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
"Default": "Host=localhost;Database=watchit;Username=postgres;Password=95sYN7qwjLxsP9w"
|
"Default": "Host=localhost;Database=watchit;Username=watchit;Password=Xdv2Etchavbuuho"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user