new models
This commit is contained in:
@@ -8,6 +8,7 @@ using System.Threading.Tasks;
|
||||
using WatchIt.Database.Model;
|
||||
using WatchIt.Database.Model.Account;
|
||||
using WatchIt.Database.Model.Genre;
|
||||
using WatchIt.Database.Model.Media;
|
||||
|
||||
namespace WatchIt.Database
|
||||
{
|
||||
@@ -31,6 +32,16 @@ namespace WatchIt.Database
|
||||
|
||||
// Genre
|
||||
public virtual DbSet<Genre> Genres { get; set; }
|
||||
public virtual DbSet<GenreMedia> GenresMedia { get; set; }
|
||||
|
||||
// Media
|
||||
public virtual DbSet<Media> Media { get; set; }
|
||||
public virtual DbSet<MediaMovie> MediaMovies { get; set; }
|
||||
public virtual DbSet<MediaSeries> MediaSeries { get; set; }
|
||||
public virtual DbSet<MediaSeriesSeason> MediaSeriesSeasons { get; set; }
|
||||
public virtual DbSet<MediaSeriesEpisode> MediaSeriesEpisodes { get; set; }
|
||||
public virtual DbSet<MediaPosterImage> MediaPosterImages { get; set; }
|
||||
public virtual DbSet<MediaPhotoImage> MediaPhotoImages { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -46,8 +57,18 @@ namespace WatchIt.Database
|
||||
EntityBuilder.Build<Account>(modelBuilder);
|
||||
EntityBuilder.Build<AccountProfilePicture>(modelBuilder);
|
||||
|
||||
// Media
|
||||
EntityBuilder.Build<Media>(modelBuilder);
|
||||
EntityBuilder.Build<MediaMovie>(modelBuilder);
|
||||
EntityBuilder.Build<MediaSeries>(modelBuilder);
|
||||
EntityBuilder.Build<MediaSeriesSeason>(modelBuilder);
|
||||
EntityBuilder.Build<MediaSeriesEpisode>(modelBuilder);
|
||||
EntityBuilder.Build<MediaPosterImage>(modelBuilder);
|
||||
EntityBuilder.Build<MediaPhotoImage>(modelBuilder);
|
||||
|
||||
// Genre
|
||||
EntityBuilder.Build<Genre>(modelBuilder);
|
||||
EntityBuilder.Build<GenreMedia>(modelBuilder);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -1,166 +0,0 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using WatchIt.Database;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace WatchIt.Database.Migrations
|
||||
{
|
||||
[DbContext(typeof(DatabaseContext))]
|
||||
[Migration("20240317131418_Migration1")]
|
||||
partial class Migration1
|
||||
{
|
||||
/// <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>("AccountProfilePictureId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("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<DateTimeOffset>("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<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("AccountProfilePictureId")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("Id")
|
||||
.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<DateTimeOffset>("UploadDate")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasDefaultValueSql("now()");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("AccountProfilePictures");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Genre.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");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Account.Account", b =>
|
||||
{
|
||||
b.HasOne("WatchIt.Database.Model.Account.AccountProfilePicture", "AccountProfilePicture")
|
||||
.WithOne("Account")
|
||||
.HasForeignKey("WatchIt.Database.Model.Account.Account", "AccountProfilePictureId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("AccountProfilePicture");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Account.AccountProfilePicture", b =>
|
||||
{
|
||||
b.Navigation("Account")
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,109 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace WatchIt.Database.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Migration1 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AccountProfilePictures",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
Image = table.Column<byte[]>(type: "bytea", maxLength: -1, nullable: false),
|
||||
MimeType = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
|
||||
UploadDate = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AccountProfilePictures", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Genres",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<short>(type: "smallint", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Name = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
|
||||
Description = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Genres", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Accounts",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Username = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
|
||||
Email = table.Column<string>(type: "character varying(320)", maxLength: 320, nullable: false),
|
||||
Description = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: false),
|
||||
AccountProfilePictureId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
Password = table.Column<byte[]>(type: "bytea", maxLength: 1000, nullable: false),
|
||||
LeftSalt = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
|
||||
RightSalt = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
|
||||
IsAdmin = table.Column<bool>(type: "boolean", nullable: false),
|
||||
CreationDate = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()"),
|
||||
LastActive = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Accounts", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Accounts_AccountProfilePictures_AccountProfilePictureId",
|
||||
column: x => x.AccountProfilePictureId,
|
||||
principalTable: "AccountProfilePictures",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AccountProfilePictures_Id",
|
||||
table: "AccountProfilePictures",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Accounts_AccountProfilePictureId",
|
||||
table: "Accounts",
|
||||
column: "AccountProfilePictureId",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Accounts_Id",
|
||||
table: "Accounts",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Genres_Id",
|
||||
table: "Genres",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Accounts");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Genres");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AccountProfilePictures");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,183 +0,0 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using WatchIt.Database;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace WatchIt.Database.Migrations
|
||||
{
|
||||
[DbContext(typeof(DatabaseContext))]
|
||||
[Migration("20240317132500_Migration2")]
|
||||
partial class Migration2
|
||||
{
|
||||
/// <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>("AccountProfilePictureId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("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<DateTimeOffset>("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<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("AccountProfilePictureId")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("Id")
|
||||
.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<DateTimeOffset>("UploadDate")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasDefaultValueSql("now()");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("AccountProfilePictures");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Genre.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"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Account.Account", b =>
|
||||
{
|
||||
b.HasOne("WatchIt.Database.Model.Account.AccountProfilePicture", "AccountProfilePicture")
|
||||
.WithOne("Account")
|
||||
.HasForeignKey("WatchIt.Database.Model.Account.Account", "AccountProfilePictureId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("AccountProfilePicture");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Account.AccountProfilePicture", b =>
|
||||
{
|
||||
b.Navigation("Account")
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||||
|
||||
namespace WatchIt.Database.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Migration2 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.InsertData(
|
||||
table: "Genres",
|
||||
columns: new[] { "Id", "Description", "Name" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ (short)1, null, "Comedy" },
|
||||
{ (short)2, null, "Thriller" },
|
||||
{ (short)3, null, "Horror" }
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Genres",
|
||||
keyColumn: "Id",
|
||||
keyValue: (short)1);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Genres",
|
||||
keyColumn: "Id",
|
||||
keyValue: (short)2);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Genres",
|
||||
keyColumn: "Id",
|
||||
keyValue: (short)3);
|
||||
}
|
||||
}
|
||||
}
|
||||
378
WatchIt.Database/WatchIt.Database/Migrations/20240317200431_Migration1.Designer.cs
generated
Normal file
378
WatchIt.Database/WatchIt.Database/Migrations/20240317200431_Migration1.Designer.cs
generated
Normal file
@@ -0,0 +1,378 @@
|
||||
// <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("20240317200431_Migration1")]
|
||||
partial class Migration1
|
||||
{
|
||||
/// <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.Genre.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"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Genre.GenreMedia", b =>
|
||||
{
|
||||
b.Property<short>("GenreId")
|
||||
.HasColumnType("smallint");
|
||||
|
||||
b.Property<long>("MediaId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("GenreId", "MediaId");
|
||||
|
||||
b.HasIndex("MediaId");
|
||||
|
||||
b.ToTable("GenreMedia");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.Media", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
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.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.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.Genre.GenreMedia", b =>
|
||||
{
|
||||
b.HasOne("WatchIt.Database.Model.Genre.Genre", "Genre")
|
||||
.WithMany("GenreMedia")
|
||||
.HasForeignKey("GenreId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("WatchIt.Database.Model.Media.Media", "Media")
|
||||
.WithMany("GenreMedia")
|
||||
.HasForeignKey("MediaId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Genre");
|
||||
|
||||
b.Navigation("Media");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.Media", b =>
|
||||
{
|
||||
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.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.Account.AccountProfilePicture", b =>
|
||||
{
|
||||
b.Navigation("Account")
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Genre.Genre", b =>
|
||||
{
|
||||
b.Navigation("GenreMedia");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.Media", b =>
|
||||
{
|
||||
b.Navigation("GenreMedia");
|
||||
|
||||
b.Navigation("MediaPhotoImages");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaPosterImage", b =>
|
||||
{
|
||||
b.Navigation("Media")
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,261 @@
|
||||
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 Migration1 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AccountProfilePictures",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
Image = table.Column<byte[]>(type: "bytea", maxLength: -1, nullable: false),
|
||||
MimeType = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
|
||||
UploadDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AccountProfilePictures", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Genres",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<short>(type: "smallint", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Name = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
|
||||
Description = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Genres", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "MediaPosterImages",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
Image = table.Column<byte[]>(type: "bytea", maxLength: -1, nullable: false),
|
||||
MimeType = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
|
||||
UploadDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MediaPosterImages", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Media",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Title = table.Column<string>(type: "character varying(250)", maxLength: 250, nullable: false),
|
||||
OriginalTitle = table.Column<string>(type: "character varying(250)", maxLength: 250, nullable: true),
|
||||
Description = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: true),
|
||||
ReleaseDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
||||
Length = table.Column<TimeSpan>(type: "interval", nullable: true),
|
||||
MediaPosterImageId = table.Column<Guid>(type: "uuid", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Media", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Media_MediaPosterImages_MediaPosterImageId",
|
||||
column: x => x.MediaPosterImageId,
|
||||
principalTable: "MediaPosterImages",
|
||||
principalColumn: "Id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "GenreMedia",
|
||||
columns: table => new
|
||||
{
|
||||
MediaId = table.Column<long>(type: "bigint", nullable: false),
|
||||
GenreId = table.Column<short>(type: "smallint", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_GenreMedia", x => new { x.GenreId, x.MediaId });
|
||||
table.ForeignKey(
|
||||
name: "FK_GenreMedia_Genres_GenreId",
|
||||
column: x => x.GenreId,
|
||||
principalTable: "Genres",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_GenreMedia_Media_MediaId",
|
||||
column: x => x.MediaId,
|
||||
principalTable: "Media",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "MediaPhotoImages",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
MediaId = table.Column<long>(type: "bigint", nullable: false),
|
||||
Image = table.Column<byte[]>(type: "bytea", maxLength: -1, nullable: false),
|
||||
MimeType = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
|
||||
UploadDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()"),
|
||||
IsMediaBackground = table.Column<bool>(type: "boolean", nullable: false, defaultValue: false),
|
||||
IsUniversalBackground = table.Column<bool>(type: "boolean", nullable: false, defaultValue: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MediaPhotoImages", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_MediaPhotoImages_Media_MediaId",
|
||||
column: x => x.MediaId,
|
||||
principalTable: "Media",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Accounts",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Username = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
|
||||
Email = table.Column<string>(type: "character varying(320)", maxLength: 320, nullable: false),
|
||||
Description = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: false),
|
||||
ProfilePictureId = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
BackgroundPictureId = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
Password = table.Column<byte[]>(type: "bytea", maxLength: 1000, nullable: false),
|
||||
LeftSalt = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
|
||||
RightSalt = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
|
||||
IsAdmin = table.Column<bool>(type: "boolean", nullable: false),
|
||||
CreationDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()"),
|
||||
LastActive = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Accounts", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Accounts_AccountProfilePictures_ProfilePictureId",
|
||||
column: x => x.ProfilePictureId,
|
||||
principalTable: "AccountProfilePictures",
|
||||
principalColumn: "Id");
|
||||
table.ForeignKey(
|
||||
name: "FK_Accounts_MediaPhotoImages_BackgroundPictureId",
|
||||
column: x => x.BackgroundPictureId,
|
||||
principalTable: "MediaPhotoImages",
|
||||
principalColumn: "Id");
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "Genres",
|
||||
columns: new[] { "Id", "Description", "Name" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ (short)1, null, "Comedy" },
|
||||
{ (short)2, null, "Thriller" },
|
||||
{ (short)3, null, "Horror" }
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AccountProfilePictures_Id",
|
||||
table: "AccountProfilePictures",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Accounts_BackgroundPictureId",
|
||||
table: "Accounts",
|
||||
column: "BackgroundPictureId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Accounts_Id",
|
||||
table: "Accounts",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Accounts_ProfilePictureId",
|
||||
table: "Accounts",
|
||||
column: "ProfilePictureId",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_GenreMedia_MediaId",
|
||||
table: "GenreMedia",
|
||||
column: "MediaId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Genres_Id",
|
||||
table: "Genres",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Media_Id",
|
||||
table: "Media",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Media_MediaPosterImageId",
|
||||
table: "Media",
|
||||
column: "MediaPosterImageId",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MediaPhotoImages_Id",
|
||||
table: "MediaPhotoImages",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MediaPhotoImages_MediaId",
|
||||
table: "MediaPhotoImages",
|
||||
column: "MediaId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MediaPosterImages_Id",
|
||||
table: "MediaPosterImages",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Accounts");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "GenreMedia");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AccountProfilePictures");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "MediaPhotoImages");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Genres");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Media");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "MediaPosterImages");
|
||||
}
|
||||
}
|
||||
}
|
||||
378
WatchIt.Database/WatchIt.Database/Migrations/20240317203820_Migration2.Designer.cs
generated
Normal file
378
WatchIt.Database/WatchIt.Database/Migrations/20240317203820_Migration2.Designer.cs
generated
Normal file
@@ -0,0 +1,378 @@
|
||||
// <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("20240317203820_Migration2")]
|
||||
partial class Migration2
|
||||
{
|
||||
/// <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.Genre.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"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Genre.GenreMedia", b =>
|
||||
{
|
||||
b.Property<short>("GenreId")
|
||||
.HasColumnType("smallint");
|
||||
|
||||
b.Property<long>("MediaId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("GenreId", "MediaId");
|
||||
|
||||
b.HasIndex("MediaId");
|
||||
|
||||
b.ToTable("GenresMedia");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.Media", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
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.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.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.Genre.GenreMedia", b =>
|
||||
{
|
||||
b.HasOne("WatchIt.Database.Model.Genre.Genre", "Genre")
|
||||
.WithMany("GenreMedia")
|
||||
.HasForeignKey("GenreId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("WatchIt.Database.Model.Media.Media", "Media")
|
||||
.WithMany("GenreMedia")
|
||||
.HasForeignKey("MediaId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Genre");
|
||||
|
||||
b.Navigation("Media");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.Media", b =>
|
||||
{
|
||||
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.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.Account.AccountProfilePicture", b =>
|
||||
{
|
||||
b.Navigation("Account")
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Genre.Genre", b =>
|
||||
{
|
||||
b.Navigation("GenreMedia");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.Media", b =>
|
||||
{
|
||||
b.Navigation("GenreMedia");
|
||||
|
||||
b.Navigation("MediaPhotoImages");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaPosterImage", b =>
|
||||
{
|
||||
b.Navigation("Media")
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace WatchIt.Database.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Migration2 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_GenreMedia_Genres_GenreId",
|
||||
table: "GenreMedia");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_GenreMedia_Media_MediaId",
|
||||
table: "GenreMedia");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_GenreMedia",
|
||||
table: "GenreMedia");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "GenreMedia",
|
||||
newName: "GenresMedia");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_GenreMedia_MediaId",
|
||||
table: "GenresMedia",
|
||||
newName: "IX_GenresMedia_MediaId");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_GenresMedia",
|
||||
table: "GenresMedia",
|
||||
columns: new[] { "GenreId", "MediaId" });
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_GenresMedia_Genres_GenreId",
|
||||
table: "GenresMedia",
|
||||
column: "GenreId",
|
||||
principalTable: "Genres",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_GenresMedia_Media_MediaId",
|
||||
table: "GenresMedia",
|
||||
column: "MediaId",
|
||||
principalTable: "Media",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_GenresMedia_Genres_GenreId",
|
||||
table: "GenresMedia");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_GenresMedia_Media_MediaId",
|
||||
table: "GenresMedia");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_GenresMedia",
|
||||
table: "GenresMedia");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "GenresMedia",
|
||||
newName: "GenreMedia");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_GenresMedia_MediaId",
|
||||
table: "GenreMedia",
|
||||
newName: "IX_GenreMedia_MediaId");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_GenreMedia",
|
||||
table: "GenreMedia",
|
||||
columns: new[] { "GenreId", "MediaId" });
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_GenreMedia_Genres_GenreId",
|
||||
table: "GenreMedia",
|
||||
column: "GenreId",
|
||||
principalTable: "Genres",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_GenreMedia_Media_MediaId",
|
||||
table: "GenreMedia",
|
||||
column: "MediaId",
|
||||
principalTable: "Media",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
||||
406
WatchIt.Database/WatchIt.Database/Migrations/20240317204255_Migration3.Designer.cs
generated
Normal file
406
WatchIt.Database/WatchIt.Database/Migrations/20240317204255_Migration3.Designer.cs
generated
Normal file
@@ -0,0 +1,406 @@
|
||||
// <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("20240317204255_Migration3")]
|
||||
partial class Migration3
|
||||
{
|
||||
/// <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.Genre.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"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Genre.GenreMedia", b =>
|
||||
{
|
||||
b.Property<short>("GenreId")
|
||||
.HasColumnType("smallint");
|
||||
|
||||
b.Property<long>("MediaId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("GenreId", "MediaId");
|
||||
|
||||
b.HasIndex("MediaId");
|
||||
|
||||
b.ToTable("GenresMedia");
|
||||
});
|
||||
|
||||
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.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.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.Genre.GenreMedia", b =>
|
||||
{
|
||||
b.HasOne("WatchIt.Database.Model.Genre.Genre", "Genre")
|
||||
.WithMany("GenreMedia")
|
||||
.HasForeignKey("GenreId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("WatchIt.Database.Model.Media.Media", "Media")
|
||||
.WithMany("GenreMedia")
|
||||
.HasForeignKey("MediaId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Genre");
|
||||
|
||||
b.Navigation("Media");
|
||||
});
|
||||
|
||||
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.MediaPosterImage", "MediaPosterImage")
|
||||
.WithOne("Media")
|
||||
.HasForeignKey("WatchIt.Database.Model.Media.Media", "MediaPosterImageId");
|
||||
|
||||
b.Navigation("MediaPosterImage");
|
||||
});
|
||||
|
||||
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.Account.AccountProfilePicture", b =>
|
||||
{
|
||||
b.Navigation("Account")
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Genre.Genre", b =>
|
||||
{
|
||||
b.Navigation("GenreMedia");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.Media", b =>
|
||||
{
|
||||
b.Navigation("GenreMedia");
|
||||
|
||||
b.Navigation("MediaPhotoImages");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaMovie", b =>
|
||||
{
|
||||
b.Navigation("Media")
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaPosterImage", b =>
|
||||
{
|
||||
b.Navigation("Media")
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace WatchIt.Database.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Migration3 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<long>(
|
||||
name: "Id",
|
||||
table: "Media",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
oldClrType: typeof(long),
|
||||
oldType: "bigint")
|
||||
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "MediaMovies",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Budget = table.Column<decimal>(type: "money", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MediaMovies", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MediaMovies_Id",
|
||||
table: "MediaMovies",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Media_MediaMovies_Id",
|
||||
table: "Media",
|
||||
column: "Id",
|
||||
principalTable: "MediaMovies",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Media_MediaMovies_Id",
|
||||
table: "Media");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "MediaMovies");
|
||||
|
||||
migrationBuilder.AlterColumn<long>(
|
||||
name: "Id",
|
||||
table: "Media",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
oldClrType: typeof(long),
|
||||
oldType: "bigint")
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
}
|
||||
}
|
||||
}
|
||||
475
WatchIt.Database/WatchIt.Database/Migrations/20240317220502_Migration4.Designer.cs
generated
Normal file
475
WatchIt.Database/WatchIt.Database/Migrations/20240317220502_Migration4.Designer.cs
generated
Normal file
@@ -0,0 +1,475 @@
|
||||
// <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("20240317220502_Migration4")]
|
||||
partial class Migration4
|
||||
{
|
||||
/// <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.Genre.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"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Genre.GenreMedia", b =>
|
||||
{
|
||||
b.Property<short>("GenreId")
|
||||
.HasColumnType("smallint");
|
||||
|
||||
b.Property<long>("MediaId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("GenreId", "MediaId");
|
||||
|
||||
b.HasIndex("MediaId");
|
||||
|
||||
b.ToTable("GenresMedia");
|
||||
});
|
||||
|
||||
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.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.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.MediaSeriesSeason", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<bool>("IsSpecial")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<long>("MediaSeriesId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<short>("Number")
|
||||
.HasColumnType("smallint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("MediaSeriesId");
|
||||
|
||||
b.ToTable("MediaSeriesSeason");
|
||||
});
|
||||
|
||||
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.Genre.GenreMedia", b =>
|
||||
{
|
||||
b.HasOne("WatchIt.Database.Model.Genre.Genre", "Genre")
|
||||
.WithMany("GenreMedia")
|
||||
.HasForeignKey("GenreId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("WatchIt.Database.Model.Media.Media", "Media")
|
||||
.WithMany("GenreMedia")
|
||||
.HasForeignKey("MediaId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Genre");
|
||||
|
||||
b.Navigation("Media");
|
||||
});
|
||||
|
||||
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.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.MediaSeriesSeason", b =>
|
||||
{
|
||||
b.HasOne("WatchIt.Database.Model.Media.MediaSeries", "MediaSeries")
|
||||
.WithMany("MediaSeriesSeasons")
|
||||
.HasForeignKey("MediaSeriesId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("MediaSeries");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Account.AccountProfilePicture", b =>
|
||||
{
|
||||
b.Navigation("Account")
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Genre.Genre", b =>
|
||||
{
|
||||
b.Navigation("GenreMedia");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.Media", b =>
|
||||
{
|
||||
b.Navigation("GenreMedia");
|
||||
|
||||
b.Navigation("MediaPhotoImages");
|
||||
});
|
||||
|
||||
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");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace WatchIt.Database.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Migration4 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "MediaSeries",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
HasEnded = table.Column<bool>(type: "boolean", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MediaSeries", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "MediaSeriesSeason",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
MediaSeriesId = table.Column<long>(type: "bigint", nullable: false),
|
||||
Number = table.Column<short>(type: "smallint", nullable: false),
|
||||
Name = table.Column<string>(type: "text", nullable: true),
|
||||
IsSpecial = table.Column<bool>(type: "boolean", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MediaSeriesSeason", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_MediaSeriesSeason_MediaSeries_MediaSeriesId",
|
||||
column: x => x.MediaSeriesId,
|
||||
principalTable: "MediaSeries",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MediaSeries_Id",
|
||||
table: "MediaSeries",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MediaSeriesSeason_MediaSeriesId",
|
||||
table: "MediaSeriesSeason",
|
||||
column: "MediaSeriesId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Media_MediaSeries_Id",
|
||||
table: "Media",
|
||||
column: "Id",
|
||||
principalTable: "MediaSeries",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Media_MediaSeries_Id",
|
||||
table: "Media");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "MediaSeriesSeason");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "MediaSeries");
|
||||
}
|
||||
}
|
||||
}
|
||||
480
WatchIt.Database/WatchIt.Database/Migrations/20240317220558_Migration5.Designer.cs
generated
Normal file
480
WatchIt.Database/WatchIt.Database/Migrations/20240317220558_Migration5.Designer.cs
generated
Normal file
@@ -0,0 +1,480 @@
|
||||
// <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("20240317220558_Migration5")]
|
||||
partial class Migration5
|
||||
{
|
||||
/// <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.Genre.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"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Genre.GenreMedia", b =>
|
||||
{
|
||||
b.Property<short>("GenreId")
|
||||
.HasColumnType("smallint");
|
||||
|
||||
b.Property<long>("MediaId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("GenreId", "MediaId");
|
||||
|
||||
b.HasIndex("MediaId");
|
||||
|
||||
b.ToTable("GenresMedia");
|
||||
});
|
||||
|
||||
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.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.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.MediaSeriesSeason", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<bool>("IsSpecial")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("boolean")
|
||||
.HasDefaultValue(false);
|
||||
|
||||
b.Property<long>("MediaSeriesId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<short>("Number")
|
||||
.HasColumnType("smallint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("MediaSeriesId");
|
||||
|
||||
b.ToTable("MediaSeriesSeasons");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Account.Account", b =>
|
||||
{
|
||||
b.HasOne("WatchIt.Database.Model.Media.MediaPhotoImage", "BackgroundPicture")
|
||||
.WithMany()
|
||||
.HasForeignKey("BackgroundPictureId");
|
||||
|
||||
b.HasOne("WatchIt.Database.Model.Account.AccountProfilePicture", "ProfilePicture")
|
||||
.WithOne("Account")
|
||||
.HasForeignKey("WatchIt.Database.Model.Account.Account", "ProfilePictureId");
|
||||
|
||||
b.Navigation("BackgroundPicture");
|
||||
|
||||
b.Navigation("ProfilePicture");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Genre.GenreMedia", b =>
|
||||
{
|
||||
b.HasOne("WatchIt.Database.Model.Genre.Genre", "Genre")
|
||||
.WithMany("GenreMedia")
|
||||
.HasForeignKey("GenreId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("WatchIt.Database.Model.Media.Media", "Media")
|
||||
.WithMany("GenreMedia")
|
||||
.HasForeignKey("MediaId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Genre");
|
||||
|
||||
b.Navigation("Media");
|
||||
});
|
||||
|
||||
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.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.MediaSeriesSeason", b =>
|
||||
{
|
||||
b.HasOne("WatchIt.Database.Model.Media.MediaSeries", "MediaSeries")
|
||||
.WithMany("MediaSeriesSeasons")
|
||||
.HasForeignKey("MediaSeriesId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("MediaSeries");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Account.AccountProfilePicture", b =>
|
||||
{
|
||||
b.Navigation("Account")
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Genre.Genre", b =>
|
||||
{
|
||||
b.Navigation("GenreMedia");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.Media", b =>
|
||||
{
|
||||
b.Navigation("GenreMedia");
|
||||
|
||||
b.Navigation("MediaPhotoImages");
|
||||
});
|
||||
|
||||
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");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace WatchIt.Database.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Migration5 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_MediaSeriesSeason_MediaSeries_MediaSeriesId",
|
||||
table: "MediaSeriesSeason");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_MediaSeriesSeason",
|
||||
table: "MediaSeriesSeason");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "MediaSeriesSeason",
|
||||
newName: "MediaSeriesSeasons");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_MediaSeriesSeason_MediaSeriesId",
|
||||
table: "MediaSeriesSeasons",
|
||||
newName: "IX_MediaSeriesSeasons_MediaSeriesId");
|
||||
|
||||
migrationBuilder.AlterColumn<bool>(
|
||||
name: "IsSpecial",
|
||||
table: "MediaSeriesSeasons",
|
||||
type: "boolean",
|
||||
nullable: false,
|
||||
defaultValue: false,
|
||||
oldClrType: typeof(bool),
|
||||
oldType: "boolean");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_MediaSeriesSeasons",
|
||||
table: "MediaSeriesSeasons",
|
||||
column: "Id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MediaSeriesSeasons_Id",
|
||||
table: "MediaSeriesSeasons",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_MediaSeriesSeasons_MediaSeries_MediaSeriesId",
|
||||
table: "MediaSeriesSeasons",
|
||||
column: "MediaSeriesId",
|
||||
principalTable: "MediaSeries",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_MediaSeriesSeasons_MediaSeries_MediaSeriesId",
|
||||
table: "MediaSeriesSeasons");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_MediaSeriesSeasons",
|
||||
table: "MediaSeriesSeasons");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_MediaSeriesSeasons_Id",
|
||||
table: "MediaSeriesSeasons");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "MediaSeriesSeasons",
|
||||
newName: "MediaSeriesSeason");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_MediaSeriesSeasons_MediaSeriesId",
|
||||
table: "MediaSeriesSeason",
|
||||
newName: "IX_MediaSeriesSeason_MediaSeriesId");
|
||||
|
||||
migrationBuilder.AlterColumn<bool>(
|
||||
name: "IsSpecial",
|
||||
table: "MediaSeriesSeason",
|
||||
type: "boolean",
|
||||
nullable: false,
|
||||
oldClrType: typeof(bool),
|
||||
oldType: "boolean",
|
||||
oldDefaultValue: false);
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_MediaSeriesSeason",
|
||||
table: "MediaSeriesSeason",
|
||||
column: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_MediaSeriesSeason_MediaSeries_MediaSeriesId",
|
||||
table: "MediaSeriesSeason",
|
||||
column: "MediaSeriesId",
|
||||
principalTable: "MediaSeries",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
||||
516
WatchIt.Database/WatchIt.Database/Migrations/20240317230106_Migration6.Designer.cs
generated
Normal file
516
WatchIt.Database/WatchIt.Database/Migrations/20240317230106_Migration6.Designer.cs
generated
Normal file
@@ -0,0 +1,516 @@
|
||||
// <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("20240317230106_Migration6")]
|
||||
partial class Migration6
|
||||
{
|
||||
/// <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.Genre.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"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Genre.GenreMedia", b =>
|
||||
{
|
||||
b.Property<short>("GenreId")
|
||||
.HasColumnType("smallint");
|
||||
|
||||
b.Property<long>("MediaId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("GenreId", "MediaId");
|
||||
|
||||
b.HasIndex("MediaId");
|
||||
|
||||
b.ToTable("GenresMedia");
|
||||
});
|
||||
|
||||
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.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.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")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<Guid>("MediaSeriesSeasonId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<short>("Number")
|
||||
.HasColumnType("smallint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("MediaSeriesSeasonId");
|
||||
|
||||
b.ToTable("MediaSeriesEpisode");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeriesSeason", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<long>("MediaSeriesId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<short>("Number")
|
||||
.HasColumnType("smallint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("MediaSeriesId");
|
||||
|
||||
b.ToTable("MediaSeriesSeasons");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Account.Account", b =>
|
||||
{
|
||||
b.HasOne("WatchIt.Database.Model.Media.MediaPhotoImage", "BackgroundPicture")
|
||||
.WithMany()
|
||||
.HasForeignKey("BackgroundPictureId");
|
||||
|
||||
b.HasOne("WatchIt.Database.Model.Account.AccountProfilePicture", "ProfilePicture")
|
||||
.WithOne("Account")
|
||||
.HasForeignKey("WatchIt.Database.Model.Account.Account", "ProfilePictureId");
|
||||
|
||||
b.Navigation("BackgroundPicture");
|
||||
|
||||
b.Navigation("ProfilePicture");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Genre.GenreMedia", b =>
|
||||
{
|
||||
b.HasOne("WatchIt.Database.Model.Genre.Genre", "Genre")
|
||||
.WithMany("GenreMedia")
|
||||
.HasForeignKey("GenreId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("WatchIt.Database.Model.Media.Media", "Media")
|
||||
.WithMany("GenreMedia")
|
||||
.HasForeignKey("MediaId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Genre");
|
||||
|
||||
b.Navigation("Media");
|
||||
});
|
||||
|
||||
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.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.MediaSeriesEpisode", b =>
|
||||
{
|
||||
b.HasOne("WatchIt.Database.Model.Media.MediaSeriesSeason", "MediaSeriesSeason")
|
||||
.WithMany("MediaSeriesEpisodes")
|
||||
.HasForeignKey("MediaSeriesSeasonId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("MediaSeriesSeason");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeriesSeason", b =>
|
||||
{
|
||||
b.HasOne("WatchIt.Database.Model.Media.MediaSeries", "MediaSeries")
|
||||
.WithMany("MediaSeriesSeasons")
|
||||
.HasForeignKey("MediaSeriesId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("MediaSeries");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Account.AccountProfilePicture", b =>
|
||||
{
|
||||
b.Navigation("Account")
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Genre.Genre", b =>
|
||||
{
|
||||
b.Navigation("GenreMedia");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.Media", b =>
|
||||
{
|
||||
b.Navigation("GenreMedia");
|
||||
|
||||
b.Navigation("MediaPhotoImages");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaMovie", b =>
|
||||
{
|
||||
b.Navigation("Media")
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaPosterImage", b =>
|
||||
{
|
||||
b.Navigation("Media")
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeries", b =>
|
||||
{
|
||||
b.Navigation("Media")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("MediaSeriesSeasons");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeriesSeason", b =>
|
||||
{
|
||||
b.Navigation("MediaSeriesEpisodes");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace WatchIt.Database.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Migration6 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "IsSpecial",
|
||||
table: "MediaSeriesSeasons");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "MediaSeriesEpisode",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
MediaSeriesSeasonId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
Number = table.Column<short>(type: "smallint", nullable: false),
|
||||
Name = table.Column<string>(type: "text", nullable: true),
|
||||
IsSpecial = table.Column<bool>(type: "boolean", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MediaSeriesEpisode", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_MediaSeriesEpisode_MediaSeriesSeasons_MediaSeriesSeasonId",
|
||||
column: x => x.MediaSeriesSeasonId,
|
||||
principalTable: "MediaSeriesSeasons",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MediaSeriesEpisode_MediaSeriesSeasonId",
|
||||
table: "MediaSeriesEpisode",
|
||||
column: "MediaSeriesSeasonId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "MediaSeriesEpisode");
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "IsSpecial",
|
||||
table: "MediaSeriesSeasons",
|
||||
type: "boolean",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
}
|
||||
}
|
||||
}
|
||||
521
WatchIt.Database/WatchIt.Database/Migrations/20240317230336_Migration7.Designer.cs
generated
Normal file
521
WatchIt.Database/WatchIt.Database/Migrations/20240317230336_Migration7.Designer.cs
generated
Normal file
@@ -0,0 +1,521 @@
|
||||
// <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("20240317230336_Migration7")]
|
||||
partial class Migration7
|
||||
{
|
||||
/// <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.Genre.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"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Genre.GenreMedia", b =>
|
||||
{
|
||||
b.Property<short>("GenreId")
|
||||
.HasColumnType("smallint");
|
||||
|
||||
b.Property<long>("MediaId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("GenreId", "MediaId");
|
||||
|
||||
b.HasIndex("MediaId");
|
||||
|
||||
b.ToTable("GenresMedia");
|
||||
});
|
||||
|
||||
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.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.MediaSeries", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<bool>("HasEnded")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("MediaSeries");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeriesEpisode", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<bool>("IsSpecial")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("boolean")
|
||||
.HasDefaultValue(false);
|
||||
|
||||
b.Property<Guid>("MediaSeriesSeasonId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<short>("Number")
|
||||
.HasColumnType("smallint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("MediaSeriesSeasonId");
|
||||
|
||||
b.ToTable("MediaSeriesEpisodes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeriesSeason", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<long>("MediaSeriesId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<short>("Number")
|
||||
.HasColumnType("smallint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("MediaSeriesId");
|
||||
|
||||
b.ToTable("MediaSeriesSeasons");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Account.Account", b =>
|
||||
{
|
||||
b.HasOne("WatchIt.Database.Model.Media.MediaPhotoImage", "BackgroundPicture")
|
||||
.WithMany()
|
||||
.HasForeignKey("BackgroundPictureId");
|
||||
|
||||
b.HasOne("WatchIt.Database.Model.Account.AccountProfilePicture", "ProfilePicture")
|
||||
.WithOne("Account")
|
||||
.HasForeignKey("WatchIt.Database.Model.Account.Account", "ProfilePictureId");
|
||||
|
||||
b.Navigation("BackgroundPicture");
|
||||
|
||||
b.Navigation("ProfilePicture");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Genre.GenreMedia", b =>
|
||||
{
|
||||
b.HasOne("WatchIt.Database.Model.Genre.Genre", "Genre")
|
||||
.WithMany("GenreMedia")
|
||||
.HasForeignKey("GenreId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("WatchIt.Database.Model.Media.Media", "Media")
|
||||
.WithMany("GenreMedia")
|
||||
.HasForeignKey("MediaId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Genre");
|
||||
|
||||
b.Navigation("Media");
|
||||
});
|
||||
|
||||
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.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.MediaSeriesEpisode", b =>
|
||||
{
|
||||
b.HasOne("WatchIt.Database.Model.Media.MediaSeriesSeason", "MediaSeriesSeason")
|
||||
.WithMany("MediaSeriesEpisodes")
|
||||
.HasForeignKey("MediaSeriesSeasonId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("MediaSeriesSeason");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeriesSeason", b =>
|
||||
{
|
||||
b.HasOne("WatchIt.Database.Model.Media.MediaSeries", "MediaSeries")
|
||||
.WithMany("MediaSeriesSeasons")
|
||||
.HasForeignKey("MediaSeriesId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("MediaSeries");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Account.AccountProfilePicture", b =>
|
||||
{
|
||||
b.Navigation("Account")
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Genre.Genre", b =>
|
||||
{
|
||||
b.Navigation("GenreMedia");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.Media", b =>
|
||||
{
|
||||
b.Navigation("GenreMedia");
|
||||
|
||||
b.Navigation("MediaPhotoImages");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaMovie", b =>
|
||||
{
|
||||
b.Navigation("Media")
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaPosterImage", b =>
|
||||
{
|
||||
b.Navigation("Media")
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeries", b =>
|
||||
{
|
||||
b.Navigation("Media")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("MediaSeriesSeasons");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeriesSeason", b =>
|
||||
{
|
||||
b.Navigation("MediaSeriesEpisodes");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace WatchIt.Database.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Migration7 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_MediaSeriesEpisode_MediaSeriesSeasons_MediaSeriesSeasonId",
|
||||
table: "MediaSeriesEpisode");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_MediaSeriesEpisode",
|
||||
table: "MediaSeriesEpisode");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "MediaSeriesEpisode",
|
||||
newName: "MediaSeriesEpisodes");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_MediaSeriesEpisode_MediaSeriesSeasonId",
|
||||
table: "MediaSeriesEpisodes",
|
||||
newName: "IX_MediaSeriesEpisodes_MediaSeriesSeasonId");
|
||||
|
||||
migrationBuilder.AlterColumn<bool>(
|
||||
name: "IsSpecial",
|
||||
table: "MediaSeriesEpisodes",
|
||||
type: "boolean",
|
||||
nullable: false,
|
||||
defaultValue: false,
|
||||
oldClrType: typeof(bool),
|
||||
oldType: "boolean");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_MediaSeriesEpisodes",
|
||||
table: "MediaSeriesEpisodes",
|
||||
column: "Id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MediaSeriesEpisodes_Id",
|
||||
table: "MediaSeriesEpisodes",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_MediaSeriesEpisodes_MediaSeriesSeasons_MediaSeriesSeasonId",
|
||||
table: "MediaSeriesEpisodes",
|
||||
column: "MediaSeriesSeasonId",
|
||||
principalTable: "MediaSeriesSeasons",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_MediaSeriesEpisodes_MediaSeriesSeasons_MediaSeriesSeasonId",
|
||||
table: "MediaSeriesEpisodes");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_MediaSeriesEpisodes",
|
||||
table: "MediaSeriesEpisodes");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_MediaSeriesEpisodes_Id",
|
||||
table: "MediaSeriesEpisodes");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "MediaSeriesEpisodes",
|
||||
newName: "MediaSeriesEpisode");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_MediaSeriesEpisodes_MediaSeriesSeasonId",
|
||||
table: "MediaSeriesEpisode",
|
||||
newName: "IX_MediaSeriesEpisode_MediaSeriesSeasonId");
|
||||
|
||||
migrationBuilder.AlterColumn<bool>(
|
||||
name: "IsSpecial",
|
||||
table: "MediaSeriesEpisode",
|
||||
type: "boolean",
|
||||
nullable: false,
|
||||
oldClrType: typeof(bool),
|
||||
oldType: "boolean",
|
||||
oldDefaultValue: false);
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_MediaSeriesEpisode",
|
||||
table: "MediaSeriesEpisode",
|
||||
column: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_MediaSeriesEpisode_MediaSeriesSeasons_MediaSeriesSeasonId",
|
||||
table: "MediaSeriesEpisode",
|
||||
column: "MediaSeriesSeasonId",
|
||||
principalTable: "MediaSeriesSeasons",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,10 +30,10 @@ namespace WatchIt.Database.Migrations
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<Guid>("AccountProfilePictureId")
|
||||
b.Property<Guid?>("BackgroundPictureId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("CreationDate")
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasDefaultValueSql("now()");
|
||||
@@ -51,7 +51,7 @@ namespace WatchIt.Database.Migrations
|
||||
b.Property<bool>("IsAdmin")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTimeOffset>("LastActive")
|
||||
b.Property<DateTime>("LastActive")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasDefaultValueSql("now()");
|
||||
@@ -66,6 +66,9 @@ namespace WatchIt.Database.Migrations
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("bytea");
|
||||
|
||||
b.Property<Guid?>("ProfilePictureId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("RightSalt")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
@@ -78,12 +81,14 @@ namespace WatchIt.Database.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AccountProfilePictureId")
|
||||
.IsUnique();
|
||||
b.HasIndex("BackgroundPictureId");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("ProfilePictureId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Accounts");
|
||||
});
|
||||
|
||||
@@ -103,7 +108,7 @@ namespace WatchIt.Database.Migrations
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)");
|
||||
|
||||
b.Property<DateTimeOffset>("UploadDate")
|
||||
b.Property<DateTime>("UploadDate")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasDefaultValueSql("now()");
|
||||
@@ -158,15 +163,311 @@ namespace WatchIt.Database.Migrations
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Genre.GenreMedia", b =>
|
||||
{
|
||||
b.Property<short>("GenreId")
|
||||
.HasColumnType("smallint");
|
||||
|
||||
b.Property<long>("MediaId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("GenreId", "MediaId");
|
||||
|
||||
b.HasIndex("MediaId");
|
||||
|
||||
b.ToTable("GenresMedia");
|
||||
});
|
||||
|
||||
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.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.MediaSeries", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<bool>("HasEnded")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("MediaSeries");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeriesEpisode", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<bool>("IsSpecial")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("boolean")
|
||||
.HasDefaultValue(false);
|
||||
|
||||
b.Property<Guid>("MediaSeriesSeasonId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<short>("Number")
|
||||
.HasColumnType("smallint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("MediaSeriesSeasonId");
|
||||
|
||||
b.ToTable("MediaSeriesEpisodes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeriesSeason", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<long>("MediaSeriesId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<short>("Number")
|
||||
.HasColumnType("smallint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("MediaSeriesId");
|
||||
|
||||
b.ToTable("MediaSeriesSeasons");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Account.Account", b =>
|
||||
{
|
||||
b.HasOne("WatchIt.Database.Model.Account.AccountProfilePicture", "AccountProfilePicture")
|
||||
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", "AccountProfilePictureId")
|
||||
.HasForeignKey("WatchIt.Database.Model.Account.Account", "ProfilePictureId");
|
||||
|
||||
b.Navigation("BackgroundPicture");
|
||||
|
||||
b.Navigation("ProfilePicture");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Genre.GenreMedia", b =>
|
||||
{
|
||||
b.HasOne("WatchIt.Database.Model.Genre.Genre", "Genre")
|
||||
.WithMany("GenreMedia")
|
||||
.HasForeignKey("GenreId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("AccountProfilePicture");
|
||||
b.HasOne("WatchIt.Database.Model.Media.Media", "Media")
|
||||
.WithMany("GenreMedia")
|
||||
.HasForeignKey("MediaId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Genre");
|
||||
|
||||
b.Navigation("Media");
|
||||
});
|
||||
|
||||
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.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.MediaSeriesEpisode", b =>
|
||||
{
|
||||
b.HasOne("WatchIt.Database.Model.Media.MediaSeriesSeason", "MediaSeriesSeason")
|
||||
.WithMany("MediaSeriesEpisodes")
|
||||
.HasForeignKey("MediaSeriesSeasonId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("MediaSeriesSeason");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeriesSeason", b =>
|
||||
{
|
||||
b.HasOne("WatchIt.Database.Model.Media.MediaSeries", "MediaSeries")
|
||||
.WithMany("MediaSeriesSeasons")
|
||||
.HasForeignKey("MediaSeriesId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("MediaSeries");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Account.AccountProfilePicture", b =>
|
||||
@@ -174,6 +475,43 @@ namespace WatchIt.Database.Migrations
|
||||
b.Navigation("Account")
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Genre.Genre", b =>
|
||||
{
|
||||
b.Navigation("GenreMedia");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.Media", b =>
|
||||
{
|
||||
b.Navigation("GenreMedia");
|
||||
|
||||
b.Navigation("MediaPhotoImages");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaMovie", b =>
|
||||
{
|
||||
b.Navigation("Media")
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaPosterImage", b =>
|
||||
{
|
||||
b.Navigation("Media")
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeries", b =>
|
||||
{
|
||||
b.Navigation("Media")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("MediaSeriesSeasons");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeriesSeason", b =>
|
||||
{
|
||||
b.Navigation("MediaSeriesEpisodes");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user