Person models added
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
[
|
||||
{
|
||||
"Id": 1,
|
||||
"Name": "Actor"
|
||||
},
|
||||
{
|
||||
"Id": 2,
|
||||
"Name": "Supporting actor"
|
||||
},
|
||||
{
|
||||
"Id": 3,
|
||||
"Name": "Voice actor"
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,14 @@
|
||||
[
|
||||
{
|
||||
"Id": 1,
|
||||
"Name": "Director"
|
||||
},
|
||||
{
|
||||
"Id": 2,
|
||||
"Name": "Producer"
|
||||
},
|
||||
{
|
||||
"Id": 3,
|
||||
"Name": "Screenwriter"
|
||||
}
|
||||
]
|
||||
@@ -6,6 +6,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WatchIt.Database.Model.Account;
|
||||
using WatchIt.Database.Model.Common;
|
||||
using WatchIt.Database.Model.Person;
|
||||
|
||||
namespace WatchIt.Database.Model.Media
|
||||
{
|
||||
@@ -28,12 +29,19 @@ namespace WatchIt.Database.Model.Media
|
||||
#region NAVIGATION
|
||||
|
||||
public MediaPosterImage? MediaPosterImage { get; set; }
|
||||
|
||||
public IEnumerable<MediaPhotoImage> MediaPhotoImages { get; set; }
|
||||
|
||||
public IEnumerable<MediaGenre> MediaGenres { get; set; }
|
||||
public IEnumerable<MediaProductionCountry> MediaProductionCountries { get; set; }
|
||||
public IEnumerable<Genre> Genres { get; set; }
|
||||
|
||||
public IEnumerable<MediaProductionCountry> MediaProductionCountries { get; set; }
|
||||
public IEnumerable<Country> ProductionCountries { get; set; }
|
||||
|
||||
public IEnumerable<PersonActorRole> PersonActorRoles { get; set; }
|
||||
|
||||
public IEnumerable<PersonCreatorRole> PersonCreatorRoles { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
69
WatchIt.Database/WatchIt.Database.Model/Person/Person.cs
Normal file
69
WatchIt.Database/WatchIt.Database.Model/Person/Person.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
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.Account;
|
||||
|
||||
namespace WatchIt.Database.Model.Person
|
||||
{
|
||||
public class Person : IEntity<Person>
|
||||
{
|
||||
#region PROPERTIES
|
||||
|
||||
public long Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string? FullName { get; set; }
|
||||
public string? Description { get; set; }
|
||||
public DateOnly? BirthDate { get; set; }
|
||||
public DateOnly? DeathDate { get; set; }
|
||||
public Guid? PersonPhotoId { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region NAVIGATION
|
||||
|
||||
public PersonPhotoImage? PersonPhoto { get; set; }
|
||||
public IEnumerable<PersonActorRole> PersonActorRoles { get; set; }
|
||||
public IEnumerable<PersonCreatorRole> PersonCreatorRoles { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region PUBLIC METHODS
|
||||
|
||||
static void IEntity<Person>.Build(EntityTypeBuilder<Person> builder)
|
||||
{
|
||||
builder.HasKey(x => x.Id);
|
||||
builder.HasIndex(x => x.Id)
|
||||
.IsUnique();
|
||||
builder.Property(x => x.Id)
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(x => x.Name)
|
||||
.HasMaxLength(100)
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(x => x.FullName)
|
||||
.HasMaxLength(200);
|
||||
|
||||
builder.Property(x => x.Description)
|
||||
.HasMaxLength(1000);
|
||||
|
||||
builder.Property(x => x.BirthDate);
|
||||
|
||||
builder.Property(x => x.DeathDate);
|
||||
|
||||
builder.HasOne(x => x.PersonPhoto)
|
||||
.WithOne(x => x.Person)
|
||||
.HasForeignKey<Person>(e => e.PersonPhotoId);
|
||||
builder.Property(x => x.PersonPhotoId);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
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.Person
|
||||
{
|
||||
public class PersonActorRole : IEntity<PersonActorRole>
|
||||
{
|
||||
#region PROPERTIES
|
||||
|
||||
public Guid Id { get; set; }
|
||||
public long PersonId { get; set; }
|
||||
public long MediaId { get; set; }
|
||||
public short PersonActorRoleTypeId { get; set; }
|
||||
public string RoleName { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region NAVIGATION
|
||||
|
||||
public Person Person { get; set; }
|
||||
public Media.Media Media { get; set; }
|
||||
public PersonActorRoleType PersonActorRoleType { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region PUBLIC METHODS
|
||||
|
||||
static void IEntity<PersonActorRole>.Build(EntityTypeBuilder<PersonActorRole> builder)
|
||||
{
|
||||
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.PersonActorRoles)
|
||||
.HasForeignKey(x => x.PersonId)
|
||||
.IsRequired();
|
||||
builder.Property(x => x.PersonId)
|
||||
.IsRequired();
|
||||
|
||||
builder.HasOne(x => x.Media)
|
||||
.WithMany(x => x.PersonActorRoles)
|
||||
.HasForeignKey(x => x.MediaId)
|
||||
.IsRequired();
|
||||
builder.Property(x => x.MediaId)
|
||||
.IsRequired();
|
||||
|
||||
builder.HasOne(x => x.PersonActorRoleType)
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.PersonActorRoleTypeId)
|
||||
.IsRequired();
|
||||
builder.Property(x => x.PersonActorRoleTypeId)
|
||||
.IsRequired();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
namespace WatchIt.Database.Model.Person
|
||||
{
|
||||
public class PersonActorRoleType : IEntity<PersonActorRoleType>
|
||||
{
|
||||
#region PROPERTIES
|
||||
|
||||
public short Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region PUBLIC METHODS
|
||||
|
||||
static void IEntity<PersonActorRoleType>.Build(EntityTypeBuilder<PersonActorRoleType> builder)
|
||||
{
|
||||
builder.HasKey(x => x.Id);
|
||||
builder.HasIndex(x => x.Id)
|
||||
.IsUnique();
|
||||
builder.Property(x => x.Id)
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(x => x.Name)
|
||||
.HasMaxLength(100)
|
||||
.IsRequired();
|
||||
}
|
||||
|
||||
static IEnumerable<PersonActorRoleType> IEntity<PersonActorRoleType>.InsertData() => DataReader.Read<PersonActorRoleType>();
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
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.Person
|
||||
{
|
||||
public class PersonCreatorRole : IEntity<PersonCreatorRole>
|
||||
{
|
||||
#region PROPERTIES
|
||||
|
||||
public Guid Id { get; set; }
|
||||
public long PersonId { get; set; }
|
||||
public long MediaId { get; set; }
|
||||
public short PersonCreatorRoleTypeId { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region NAVIGATION
|
||||
|
||||
public Person Person { get; set; }
|
||||
public Media.Media Media { get; set; }
|
||||
public PersonCreatorRoleType PersonCreatorRoleType { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region PUBLIC METHODS
|
||||
|
||||
static void IEntity<PersonCreatorRole>.Build(EntityTypeBuilder<PersonCreatorRole> builder)
|
||||
{
|
||||
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.PersonCreatorRoles)
|
||||
.HasForeignKey(x => x.PersonId)
|
||||
.IsRequired();
|
||||
builder.Property(x => x.PersonId)
|
||||
.IsRequired();
|
||||
|
||||
builder.HasOne(x => x.Media)
|
||||
.WithMany(x => x.PersonCreatorRoles)
|
||||
.HasForeignKey(x => x.MediaId)
|
||||
.IsRequired();
|
||||
builder.Property(x => x.MediaId)
|
||||
.IsRequired();
|
||||
|
||||
builder.HasOne(x => x.PersonCreatorRoleType)
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.PersonCreatorRoleTypeId)
|
||||
.IsRequired();
|
||||
builder.Property(x => x.PersonCreatorRoleTypeId)
|
||||
.IsRequired();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
namespace WatchIt.Database.Model.Person
|
||||
{
|
||||
public class PersonCreatorRoleType : IEntity<PersonCreatorRoleType>
|
||||
{
|
||||
#region PROPERTIES
|
||||
|
||||
public short Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region PUBLIC METHODS
|
||||
|
||||
static void IEntity<PersonCreatorRoleType>.Build(EntityTypeBuilder<PersonCreatorRoleType> builder)
|
||||
{
|
||||
builder.HasKey(x => x.Id);
|
||||
builder.HasIndex(x => x.Id)
|
||||
.IsUnique();
|
||||
builder.Property(x => x.Id)
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(x => x.Name)
|
||||
.HasMaxLength(100)
|
||||
.IsRequired();
|
||||
}
|
||||
|
||||
static IEnumerable<PersonCreatorRoleType> IEntity<PersonCreatorRoleType>.InsertData() => DataReader.Read<PersonCreatorRoleType>();
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
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.Account;
|
||||
|
||||
namespace WatchIt.Database.Model.Person
|
||||
{
|
||||
public class PersonPhotoImage : IEntity<PersonPhotoImage>
|
||||
{
|
||||
#region PROPERTIES
|
||||
|
||||
public Guid Id { get; set; }
|
||||
public byte[] Image { get; set; }
|
||||
public string MimeType { get; set; }
|
||||
public DateTime UploadDate { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region NAVIGATION
|
||||
|
||||
public Person Person { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region PUBLIC METHODS
|
||||
|
||||
static void IEntity<PersonPhotoImage>.Build(EntityTypeBuilder<PersonPhotoImage> builder)
|
||||
{
|
||||
builder.HasKey(x => x.Id);
|
||||
builder.HasIndex(x => x.Id)
|
||||
.IsUnique();
|
||||
builder.Property(x => x.Id)
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(x => x.Image)
|
||||
.HasMaxLength(-1)
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(x => x.MimeType)
|
||||
.HasMaxLength(50)
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(x => x.UploadDate)
|
||||
.IsRequired()
|
||||
.HasDefaultValueSql("now()");
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ using WatchIt.Database.Model;
|
||||
using WatchIt.Database.Model.Account;
|
||||
using WatchIt.Database.Model.Common;
|
||||
using WatchIt.Database.Model.Media;
|
||||
using WatchIt.Database.Model.Person;
|
||||
|
||||
namespace WatchIt.Database
|
||||
{
|
||||
@@ -45,6 +46,14 @@ namespace WatchIt.Database
|
||||
public virtual DbSet<MediaGenre> MediaGenres { get; set; }
|
||||
public virtual DbSet<MediaProductionCountry> MediaProductionCountrys { get; set; }
|
||||
|
||||
// Person
|
||||
public virtual DbSet<Person> Persons { get; set; }
|
||||
public virtual DbSet<PersonPhotoImage> PersonPhotoImages { get; set; }
|
||||
public virtual DbSet<PersonActorRole> PersonActorRoles { get; set; }
|
||||
public virtual DbSet<PersonActorRoleType> PersonActorRoleTypes { get; set; }
|
||||
public virtual DbSet<PersonCreatorRole> PersonCreatorRoles { get; set; }
|
||||
public virtual DbSet<PersonCreatorRoleType> PersonCreatorRoleTypes { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -73,6 +82,14 @@ namespace WatchIt.Database
|
||||
EntityBuilder.Build<MediaPhotoImage>(modelBuilder);
|
||||
EntityBuilder.Build<MediaGenre>(modelBuilder);
|
||||
EntityBuilder.Build<MediaProductionCountry>(modelBuilder);
|
||||
|
||||
// Person
|
||||
EntityBuilder.Build<Person>(modelBuilder);
|
||||
EntityBuilder.Build<PersonPhotoImage>(modelBuilder);
|
||||
EntityBuilder.Build<PersonActorRole>(modelBuilder);
|
||||
EntityBuilder.Build<PersonActorRoleType>(modelBuilder);
|
||||
EntityBuilder.Build<PersonCreatorRole>(modelBuilder);
|
||||
EntityBuilder.Build<PersonCreatorRoleType>(modelBuilder);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
690
WatchIt.Database/WatchIt.Database/Migrations/20240319225625_0001_PersonTableAdded.Designer.cs
generated
Normal file
690
WatchIt.Database/WatchIt.Database/Migrations/20240319225625_0001_PersonTableAdded.Designer.cs
generated
Normal file
@@ -0,0 +1,690 @@
|
||||
// <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("20240319225625_0001_PersonTableAdded")]
|
||||
partial class _0001_PersonTableAdded
|
||||
{
|
||||
/// <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.Person.Person", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<DateOnly?>("BirthDate")
|
||||
.HasColumnType("date");
|
||||
|
||||
b.Property<DateOnly?>("DeathDate")
|
||||
.HasColumnType("date");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("character varying(1000)");
|
||||
|
||||
b.Property<string>("FullName")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("character varying(200)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)");
|
||||
|
||||
b.Property<Guid?>("PersonPhotoId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("PersonPhotoId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Persons");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Person.PersonPhotoImage", 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("PersonPhotoImages");
|
||||
});
|
||||
|
||||
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.Person.Person", b =>
|
||||
{
|
||||
b.HasOne("WatchIt.Database.Model.Person.PersonPhotoImage", "PersonPhoto")
|
||||
.WithOne("Person")
|
||||
.HasForeignKey("WatchIt.Database.Model.Person.Person", "PersonPhotoId");
|
||||
|
||||
b.Navigation("PersonPhoto");
|
||||
});
|
||||
|
||||
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");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Person.PersonPhotoImage", b =>
|
||||
{
|
||||
b.Navigation("Person")
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
795
WatchIt.Database/WatchIt.Database/Migrations/20240319232340_0002_PersonActorTableAdded.Designer.cs
generated
Normal file
795
WatchIt.Database/WatchIt.Database/Migrations/20240319232340_0002_PersonActorTableAdded.Designer.cs
generated
Normal file
@@ -0,0 +1,795 @@
|
||||
// <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("20240319232340_0002_PersonActorTableAdded")]
|
||||
partial class _0002_PersonActorTableAdded
|
||||
{
|
||||
/// <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.Person.Person", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<DateOnly?>("BirthDate")
|
||||
.HasColumnType("date");
|
||||
|
||||
b.Property<DateOnly?>("DeathDate")
|
||||
.HasColumnType("date");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("character varying(1000)");
|
||||
|
||||
b.Property<string>("FullName")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("character varying(200)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)");
|
||||
|
||||
b.Property<Guid?>("PersonPhotoId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("PersonPhotoId")
|
||||
.IsUnique();
|
||||
|
||||
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.PersonPhotoImage", 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("PersonPhotoImages");
|
||||
});
|
||||
|
||||
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.Person.Person", b =>
|
||||
{
|
||||
b.HasOne("WatchIt.Database.Model.Person.PersonPhotoImage", "PersonPhoto")
|
||||
.WithOne("Person")
|
||||
.HasForeignKey("WatchIt.Database.Model.Person.Person", "PersonPhotoId");
|
||||
|
||||
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.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");
|
||||
|
||||
b.Navigation("PersonActorRoles");
|
||||
});
|
||||
|
||||
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");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Person.Person", b =>
|
||||
{
|
||||
b.Navigation("PersonActorRoles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Person.PersonPhotoImage", b =>
|
||||
{
|
||||
b.Navigation("Person")
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
893
WatchIt.Database/WatchIt.Database/Migrations/20240319233241_0003_PersonCreatorTableAdded.Designer.cs
generated
Normal file
893
WatchIt.Database/WatchIt.Database/Migrations/20240319233241_0003_PersonCreatorTableAdded.Designer.cs
generated
Normal file
@@ -0,0 +1,893 @@
|
||||
// <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("20240319233241_0003_PersonCreatorTableAdded")]
|
||||
partial class _0003_PersonCreatorTableAdded
|
||||
{
|
||||
/// <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.Person.Person", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<DateOnly?>("BirthDate")
|
||||
.HasColumnType("date");
|
||||
|
||||
b.Property<DateOnly?>("DeathDate")
|
||||
.HasColumnType("date");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("character varying(1000)");
|
||||
|
||||
b.Property<string>("FullName")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("character varying(200)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)");
|
||||
|
||||
b.Property<Guid?>("PersonPhotoId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("PersonPhotoId")
|
||||
.IsUnique();
|
||||
|
||||
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 =>
|
||||
{
|
||||
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("PersonPhotoImages");
|
||||
});
|
||||
|
||||
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.Person.Person", b =>
|
||||
{
|
||||
b.HasOne("WatchIt.Database.Model.Person.PersonPhotoImage", "PersonPhoto")
|
||||
.WithOne("Person")
|
||||
.HasForeignKey("WatchIt.Database.Model.Person.Person", "PersonPhotoId");
|
||||
|
||||
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.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");
|
||||
|
||||
b.Navigation("PersonActorRoles");
|
||||
|
||||
b.Navigation("PersonCreatorRoles");
|
||||
});
|
||||
|
||||
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");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Person.Person", b =>
|
||||
{
|
||||
b.Navigation("PersonActorRoles");
|
||||
|
||||
b.Navigation("PersonCreatorRoles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Person.PersonPhotoImage", b =>
|
||||
{
|
||||
b.Navigation("Person")
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -440,6 +440,214 @@ namespace WatchIt.Database.Migrations
|
||||
b.ToTable("MediaSeriesSeasons");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Person.Person", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<DateOnly?>("BirthDate")
|
||||
.HasColumnType("date");
|
||||
|
||||
b.Property<DateOnly?>("DeathDate")
|
||||
.HasColumnType("date");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("character varying(1000)");
|
||||
|
||||
b.Property<string>("FullName")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("character varying(200)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)");
|
||||
|
||||
b.Property<Guid?>("PersonPhotoId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("PersonPhotoId")
|
||||
.IsUnique();
|
||||
|
||||
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 =>
|
||||
{
|
||||
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("PersonPhotoImages");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Account.Account", b =>
|
||||
{
|
||||
b.HasOne("WatchIt.Database.Model.Media.MediaPhotoImage", "BackgroundPicture")
|
||||
@@ -547,6 +755,69 @@ namespace WatchIt.Database.Migrations
|
||||
b.Navigation("MediaSeries");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Person.Person", b =>
|
||||
{
|
||||
b.HasOne("WatchIt.Database.Model.Person.PersonPhotoImage", "PersonPhoto")
|
||||
.WithOne("Person")
|
||||
.HasForeignKey("WatchIt.Database.Model.Person.Person", "PersonPhotoId");
|
||||
|
||||
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.Account.AccountProfilePicture", b =>
|
||||
{
|
||||
b.Navigation("Account")
|
||||
@@ -570,6 +841,10 @@ namespace WatchIt.Database.Migrations
|
||||
b.Navigation("MediaPhotoImages");
|
||||
|
||||
b.Navigation("MediaProductionCountries");
|
||||
|
||||
b.Navigation("PersonActorRoles");
|
||||
|
||||
b.Navigation("PersonCreatorRoles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaMovie", b =>
|
||||
@@ -596,6 +871,19 @@ namespace WatchIt.Database.Migrations
|
||||
{
|
||||
b.Navigation("MediaSeriesEpisodes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Person.Person", b =>
|
||||
{
|
||||
b.Navigation("PersonActorRoles");
|
||||
|
||||
b.Navigation("PersonCreatorRoles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Person.PersonPhotoImage", b =>
|
||||
{
|
||||
b.Navigation("Person")
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user