project reorganized
This commit is contained in:
@@ -1,126 +1,114 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Principal;
|
||||
using System.Reflection;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WatchIt.Database.Model;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using SimpleToolkit.Extensions;
|
||||
using WatchIt.Database.Model.Account;
|
||||
using WatchIt.Database.Model.Common;
|
||||
using WatchIt.Database.Model.Configuration.Account;
|
||||
using WatchIt.Database.Model.Media;
|
||||
using WatchIt.Database.Model.Person;
|
||||
using WatchIt.Database.Model.Rating;
|
||||
using WatchIt.Database.Model.ViewCount;
|
||||
|
||||
namespace WatchIt.Database
|
||||
namespace WatchIt.Database;
|
||||
|
||||
public class DatabaseContext : DbContext
|
||||
{
|
||||
public class DatabaseContext : DbContext
|
||||
#region CONSTRUCTORS
|
||||
|
||||
public DatabaseContext()
|
||||
{
|
||||
#region CONSTRUCTORS
|
||||
|
||||
public DatabaseContext() { }
|
||||
|
||||
public DatabaseContext(DbContextOptions<DatabaseContext> options) : base(options) { }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region PROPERTIES
|
||||
|
||||
// Common
|
||||
public virtual DbSet<Country> Countries { get; set; }
|
||||
public virtual DbSet<Genre> Genres { get; set; }
|
||||
public virtual DbSet<Gender> Genders { get; set; }
|
||||
|
||||
// Account
|
||||
public virtual DbSet<Account> Accounts { get; set; }
|
||||
public virtual DbSet<AccountProfilePicture> AccountProfilePictures { get; set; }
|
||||
public virtual DbSet<AccountRefreshToken> AccountRefreshTokens { 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; }
|
||||
public virtual DbSet<MediaGenre> MediaGenres { get; set; }
|
||||
public virtual DbSet<MediaProductionCountry> MediaProductionCountrys { get; set; }
|
||||
|
||||
// Person
|
||||
public virtual DbSet<Person> Persons { get; set; }
|
||||
public virtual DbSet<PersonPhotoImage> PersonPhotoImages { get; set; }
|
||||
public virtual DbSet<PersonActorRole> PersonActorRoles { get; set; }
|
||||
public virtual DbSet<PersonActorRoleType> PersonActorRoleTypes { get; set; }
|
||||
public virtual DbSet<PersonCreatorRole> PersonCreatorRoles { get; set; }
|
||||
public virtual DbSet<PersonCreatorRoleType> PersonCreatorRoleTypes { get; set; }
|
||||
|
||||
// Rating
|
||||
public virtual DbSet<RatingMedia> RatingsMedia { get; set; }
|
||||
public virtual DbSet<RatingPersonActorRole> RatingsPersonActorRole { get; set; }
|
||||
public virtual DbSet<RatingPersonActorRole> RatingsPersonCreatorRole { get; set; }
|
||||
public virtual DbSet<RatingMediaSeriesSeason> RatingsMediaSeriesSeason { get; set; }
|
||||
public virtual DbSet<RatingMediaSeriesEpisode> RatingsMediaSeriesEpisode { get; set; }
|
||||
|
||||
// ViewCount
|
||||
public virtual DbSet<ViewCountPerson> ViewCountsPerson { get; set; }
|
||||
public virtual DbSet<ViewCountMedia> ViewCountsMedia { get; set; }
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region METHODS
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) => optionsBuilder.UseNpgsql("name=Default");
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
// Common
|
||||
EntityBuilder.Build<Country>(modelBuilder);
|
||||
EntityBuilder.Build<Genre>(modelBuilder);
|
||||
EntityBuilder.Build<Gender>(modelBuilder);
|
||||
|
||||
// Account
|
||||
EntityBuilder.Build<Account>(modelBuilder);
|
||||
EntityBuilder.Build<AccountProfilePicture>(modelBuilder);
|
||||
EntityBuilder.Build<AccountRefreshToken>(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);
|
||||
EntityBuilder.Build<MediaGenre>(modelBuilder);
|
||||
EntityBuilder.Build<MediaProductionCountry>(modelBuilder);
|
||||
|
||||
// Person
|
||||
EntityBuilder.Build<Person>(modelBuilder);
|
||||
EntityBuilder.Build<PersonPhotoImage>(modelBuilder);
|
||||
EntityBuilder.Build<PersonActorRole>(modelBuilder);
|
||||
EntityBuilder.Build<PersonActorRoleType>(modelBuilder);
|
||||
EntityBuilder.Build<PersonCreatorRole>(modelBuilder);
|
||||
EntityBuilder.Build<PersonCreatorRoleType>(modelBuilder);
|
||||
|
||||
// Rating
|
||||
EntityBuilder.Build<RatingMedia>(modelBuilder);
|
||||
EntityBuilder.Build<RatingPersonActorRole>(modelBuilder);
|
||||
EntityBuilder.Build<RatingPersonCreatorRole>(modelBuilder);
|
||||
EntityBuilder.Build<RatingMediaSeriesSeason>(modelBuilder);
|
||||
EntityBuilder.Build<RatingMediaSeriesEpisode>(modelBuilder);
|
||||
|
||||
// ViewCounts
|
||||
EntityBuilder.Build<ViewCountMedia>(modelBuilder);
|
||||
EntityBuilder.Build<ViewCountPerson>(modelBuilder);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
public DatabaseContext(DbContextOptions<DatabaseContext> options) : base(options)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region PROPERTIES
|
||||
|
||||
// Common
|
||||
public virtual DbSet<Country> Countries { get; set; }
|
||||
public virtual DbSet<Genre> Genres { get; set; }
|
||||
public virtual DbSet<Gender> Genders { get; set; }
|
||||
|
||||
// Account
|
||||
public virtual DbSet<Account> Accounts { get; set; }
|
||||
public virtual DbSet<AccountProfilePicture> AccountProfilePictures { get; set; }
|
||||
public virtual DbSet<AccountRefreshToken> AccountRefreshTokens { 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; }
|
||||
public virtual DbSet<MediaGenre> MediaGenres { get; set; }
|
||||
public virtual DbSet<MediaProductionCountry> MediaProductionCountries { get; set; }
|
||||
|
||||
// Person
|
||||
public virtual DbSet<Person> Persons { get; set; }
|
||||
public virtual DbSet<PersonPhotoImage> PersonPhotoImages { get; set; }
|
||||
public virtual DbSet<PersonActorRole> PersonActorRoles { get; set; }
|
||||
public virtual DbSet<PersonActorRoleType> PersonActorRoleTypes { get; set; }
|
||||
public virtual DbSet<PersonCreatorRole> PersonCreatorRoles { get; set; }
|
||||
public virtual DbSet<PersonCreatorRoleType> PersonCreatorRoleTypes { get; set; }
|
||||
|
||||
// Rating
|
||||
public virtual DbSet<RatingMedia> RatingsMedia { get; set; }
|
||||
public virtual DbSet<RatingPersonActorRole> RatingsPersonActorRole { get; set; }
|
||||
public virtual DbSet<RatingPersonActorRole> RatingsPersonCreatorRole { get; set; }
|
||||
public virtual DbSet<RatingMediaSeriesSeason> RatingsMediaSeriesSeason { get; set; }
|
||||
public virtual DbSet<RatingMediaSeriesEpisode> RatingsMediaSeriesEpisode { get; set; }
|
||||
|
||||
// ViewCount
|
||||
public virtual DbSet<ViewCountPerson> ViewCountsPerson { get; set; }
|
||||
public virtual DbSet<ViewCountMedia> ViewCountsMedia { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region PROTECTED METHODS
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
optionsBuilder.UseNpgsql("name=Default");
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.ApplyConfigurationsFromAssembly(Assembly.GetAssembly(typeof(AccountConfiguration)));
|
||||
CreateRootUser(modelBuilder);
|
||||
}
|
||||
|
||||
protected void CreateRootUser(ModelBuilder modelBuilder)
|
||||
{
|
||||
IConfigurationSection configuration = this.GetService<IConfiguration>().GetSection("RootUser");
|
||||
|
||||
string leftSalt = StringExtensions.CreateRandom(20);
|
||||
string rightSalt = StringExtensions.CreateRandom(20);
|
||||
byte[] hash = SHA512.HashData(Encoding.UTF8.GetBytes($"{leftSalt}{configuration["Password"]}{rightSalt}"));
|
||||
|
||||
modelBuilder.Entity<Account>().HasData(new Account
|
||||
{
|
||||
Id = 1,
|
||||
Username = configuration["Username"]!,
|
||||
Email = configuration["Email"]!,
|
||||
Password = hash,
|
||||
LeftSalt = leftSalt,
|
||||
RightSalt = rightSalt,
|
||||
IsAdmin = true,
|
||||
});
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,123 +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 _0001_GendersTableAdded : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Accounts_Gender_GenderId",
|
||||
table: "Accounts");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Persons_Gender_GenderId",
|
||||
table: "Persons");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_Gender",
|
||||
table: "Gender");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "Gender",
|
||||
newName: "Genders");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_Genders",
|
||||
table: "Genders",
|
||||
column: "Id");
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "Genders",
|
||||
columns: new[] { "Id", "Name" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ (short)1, "Male" },
|
||||
{ (short)2, "Female" }
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Genders_Id",
|
||||
table: "Genders",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Accounts_Genders_GenderId",
|
||||
table: "Accounts",
|
||||
column: "GenderId",
|
||||
principalTable: "Genders",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Persons_Genders_GenderId",
|
||||
table: "Persons",
|
||||
column: "GenderId",
|
||||
principalTable: "Genders",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Accounts_Genders_GenderId",
|
||||
table: "Accounts");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Persons_Genders_GenderId",
|
||||
table: "Persons");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_Genders",
|
||||
table: "Genders");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Genders_Id",
|
||||
table: "Genders");
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Genders",
|
||||
keyColumn: "Id",
|
||||
keyValue: (short)1);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Genders",
|
||||
keyColumn: "Id",
|
||||
keyValue: (short)2);
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "Genders",
|
||||
newName: "Gender");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_Gender",
|
||||
table: "Gender",
|
||||
column: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Accounts_Gender_GenderId",
|
||||
table: "Accounts",
|
||||
column: "GenderId",
|
||||
principalTable: "Gender",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Persons_Gender_GenderId",
|
||||
table: "Persons",
|
||||
column: "GenderId",
|
||||
principalTable: "Gender",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,87 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace WatchIt.Database.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class _0002_ViewCountTablesAdded : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ViewCountsMedia",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
MediaId = table.Column<long>(type: "bigint", nullable: false),
|
||||
Date = table.Column<DateOnly>(type: "date", nullable: false, defaultValueSql: "now()"),
|
||||
ViewCount = table.Column<long>(type: "bigint", nullable: false, defaultValue: 0L)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ViewCountsMedia", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ViewCountsMedia_Media_MediaId",
|
||||
column: x => x.MediaId,
|
||||
principalTable: "Media",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ViewCountsPerson",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
PersonId = table.Column<long>(type: "bigint", nullable: false),
|
||||
Date = table.Column<DateOnly>(type: "date", nullable: false, defaultValueSql: "now()"),
|
||||
ViewCount = table.Column<long>(type: "bigint", nullable: false, defaultValue: 0L)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ViewCountsPerson", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ViewCountsPerson_Persons_PersonId",
|
||||
column: x => x.PersonId,
|
||||
principalTable: "Persons",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ViewCountsMedia_Id",
|
||||
table: "ViewCountsMedia",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ViewCountsMedia_MediaId",
|
||||
table: "ViewCountsMedia",
|
||||
column: "MediaId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ViewCountsPerson_Id",
|
||||
table: "ViewCountsPerson",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ViewCountsPerson_PersonId",
|
||||
table: "ViewCountsPerson",
|
||||
column: "PersonId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "ViewCountsMedia");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ViewCountsPerson");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,77 +0,0 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace WatchIt.Database.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class _0003_GenderNotRequiredAndDefaultNotAdmin : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Accounts_Genders_GenderId",
|
||||
table: "Accounts");
|
||||
|
||||
migrationBuilder.AlterColumn<bool>(
|
||||
name: "IsAdmin",
|
||||
table: "Accounts",
|
||||
type: "boolean",
|
||||
nullable: false,
|
||||
defaultValue: false,
|
||||
oldClrType: typeof(bool),
|
||||
oldType: "boolean");
|
||||
|
||||
migrationBuilder.AlterColumn<short>(
|
||||
name: "GenderId",
|
||||
table: "Accounts",
|
||||
type: "smallint",
|
||||
nullable: true,
|
||||
oldClrType: typeof(short),
|
||||
oldType: "smallint");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Accounts_Genders_GenderId",
|
||||
table: "Accounts",
|
||||
column: "GenderId",
|
||||
principalTable: "Genders",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Accounts_Genders_GenderId",
|
||||
table: "Accounts");
|
||||
|
||||
migrationBuilder.AlterColumn<bool>(
|
||||
name: "IsAdmin",
|
||||
table: "Accounts",
|
||||
type: "boolean",
|
||||
nullable: false,
|
||||
oldClrType: typeof(bool),
|
||||
oldType: "boolean",
|
||||
oldDefaultValue: false);
|
||||
|
||||
migrationBuilder.AlterColumn<short>(
|
||||
name: "GenderId",
|
||||
table: "Accounts",
|
||||
type: "smallint",
|
||||
nullable: false,
|
||||
defaultValue: (short)0,
|
||||
oldClrType: typeof(short),
|
||||
oldType: "smallint",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Accounts_Genders_GenderId",
|
||||
table: "Accounts",
|
||||
column: "GenderId",
|
||||
principalTable: "Genders",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,40 +0,0 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace WatchIt.Database.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class _0004_AccountDescriptionNullable : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Description",
|
||||
table: "Accounts",
|
||||
type: "character varying(1000)",
|
||||
maxLength: 1000,
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(1000)",
|
||||
oldMaxLength: 1000);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Description",
|
||||
table: "Accounts",
|
||||
type: "character varying(1000)",
|
||||
maxLength: 1000,
|
||||
nullable: false,
|
||||
defaultValue: "",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(1000)",
|
||||
oldMaxLength: 1000,
|
||||
oldNullable: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,52 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace WatchIt.Database.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class _0005_AccountRefreshTokensAdded : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AccountRefreshTokens",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
AccountId = table.Column<long>(type: "bigint", nullable: false),
|
||||
Lifetime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AccountRefreshTokens", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_AccountRefreshTokens_Accounts_AccountId",
|
||||
column: x => x.AccountId,
|
||||
principalTable: "Accounts",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AccountRefreshTokens_AccountId",
|
||||
table: "AccountRefreshTokens",
|
||||
column: "AccountId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AccountRefreshTokens_Id",
|
||||
table: "AccountRefreshTokens",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "AccountRefreshTokens");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace WatchIt.Database.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class _0006_AccountRefreshTokenChanges : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "Lifetime",
|
||||
table: "AccountRefreshTokens",
|
||||
newName: "ExpirationDate");
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "IsExtendable",
|
||||
table: "AccountRefreshTokens",
|
||||
type: "boolean",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "IsExtendable",
|
||||
table: "AccountRefreshTokens");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "ExpirationDate",
|
||||
table: "AccountRefreshTokens",
|
||||
newName: "Lifetime");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,15 +12,18 @@ using WatchIt.Database;
|
||||
namespace WatchIt.Database.Migrations
|
||||
{
|
||||
[DbContext(typeof(DatabaseContext))]
|
||||
[Migration("20240324205952_0006_AccountRefreshTokenChanges")]
|
||||
partial class _0006_AccountRefreshTokenChanges
|
||||
[Migration("20240418190404_0001_Initial")]
|
||||
partial class _0001_Initial
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.3")
|
||||
.HasAnnotation("ProductVersion", "8.0.4")
|
||||
.HasAnnotation("Proxies:ChangeTracking", false)
|
||||
.HasAnnotation("Proxies:CheckEquality", false)
|
||||
.HasAnnotation("Proxies:LazyLoading", true)
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
@@ -99,6 +102,20 @@ namespace WatchIt.Database.Migrations
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Accounts");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1L,
|
||||
CreationDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Email = "root@watch.it",
|
||||
IsAdmin = true,
|
||||
LastActive = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
LeftSalt = "qE]Q^g%tU\"6Uu^GfE:V:",
|
||||
Password = new byte[] { 165, 250, 135, 31, 187, 161, 15, 246, 18, 232, 64, 25, 37, 173, 91, 111, 140, 177, 183, 84, 254, 177, 15, 235, 119, 219, 29, 169, 32, 108, 187, 121, 204, 51, 213, 28, 141, 89, 91, 226, 0, 23, 7, 91, 139, 230, 151, 104, 62, 91, 59, 6, 207, 26, 200, 141, 104, 5, 151, 201, 243, 163, 28, 248 },
|
||||
RightSalt = "T7j)~.#%~ZtOFUZFK,K+",
|
||||
Username = "root"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Account.AccountProfilePicture", b =>
|
||||
@@ -163,6 +180,11 @@ namespace WatchIt.Database.Migrations
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<short>("Id"));
|
||||
|
||||
b.Property<bool>("IsHistorical")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("boolean")
|
||||
.HasDefaultValue(false);
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
@@ -179,11 +201,13 @@ namespace WatchIt.Database.Migrations
|
||||
new
|
||||
{
|
||||
Id = (short)1,
|
||||
IsHistorical = false,
|
||||
Name = "Afghanistan"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = (short)2,
|
||||
IsHistorical = false,
|
||||
Name = "Albania"
|
||||
});
|
||||
});
|
||||
@@ -229,8 +253,7 @@ namespace WatchIt.Database.Migrations
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<short>("Id"));
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("character varying(1000)");
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
@@ -275,14 +298,17 @@ namespace WatchIt.Database.Migrations
|
||||
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<short?>("Length")
|
||||
.HasColumnType("smallint");
|
||||
|
||||
b.Property<Guid?>("MediaPosterImageId")
|
||||
.HasColumnType("uuid");
|
||||
@@ -291,8 +317,8 @@ namespace WatchIt.Database.Migrations
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("character varying(250)");
|
||||
|
||||
b.Property<DateTime?>("ReleaseDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
b.Property<DateOnly?>("ReleaseDate")
|
||||
.HasColumnType("date");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
@@ -328,11 +354,8 @@ namespace WatchIt.Database.Migrations
|
||||
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");
|
||||
|
||||
@@ -435,13 +458,12 @@ namespace WatchIt.Database.Migrations
|
||||
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");
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("boolean")
|
||||
.HasDefaultValue(false);
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
@@ -528,7 +550,7 @@ namespace WatchIt.Database.Migrations
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("character varying(200)");
|
||||
|
||||
b.Property<short>("GenderId")
|
||||
b.Property<short?>("GenderId")
|
||||
.HasColumnType("smallint");
|
||||
|
||||
b.Property<string>("Name")
|
||||
@@ -946,18 +968,6 @@ namespace WatchIt.Database.Migrations
|
||||
|
||||
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");
|
||||
@@ -984,6 +994,17 @@ namespace WatchIt.Database.Migrations
|
||||
b.Navigation("Media");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaMovie", b =>
|
||||
{
|
||||
b.HasOne("WatchIt.Database.Model.Media.Media", "Media")
|
||||
.WithOne()
|
||||
.HasForeignKey("WatchIt.Database.Model.Media.MediaMovie", "Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Media");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaPhotoImage", b =>
|
||||
{
|
||||
b.HasOne("WatchIt.Database.Model.Media.Media", "Media")
|
||||
@@ -1014,6 +1035,17 @@ namespace WatchIt.Database.Migrations
|
||||
b.Navigation("Media");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeries", b =>
|
||||
{
|
||||
b.HasOne("WatchIt.Database.Model.Media.Media", "Media")
|
||||
.WithOne()
|
||||
.HasForeignKey("WatchIt.Database.Model.Media.MediaSeries", "Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Media");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeriesEpisode", b =>
|
||||
{
|
||||
b.HasOne("WatchIt.Database.Model.Media.MediaSeriesSeason", "MediaSeriesSeason")
|
||||
@@ -1040,9 +1072,7 @@ namespace WatchIt.Database.Migrations
|
||||
{
|
||||
b.HasOne("WatchIt.Database.Model.Common.Gender", "Gender")
|
||||
.WithMany()
|
||||
.HasForeignKey("GenderId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
.HasForeignKey("GenderId");
|
||||
|
||||
b.HasOne("WatchIt.Database.Model.Person.PersonPhotoImage", "PersonPhoto")
|
||||
.WithOne("Person")
|
||||
@@ -1272,12 +1302,6 @@ namespace WatchIt.Database.Migrations
|
||||
b.Navigation("ViewCountsMedia");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaMovie", b =>
|
||||
{
|
||||
b.Navigation("Media")
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaPosterImage", b =>
|
||||
{
|
||||
b.Navigation("Media")
|
||||
@@ -1286,9 +1310,6 @@ namespace WatchIt.Database.Migrations
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeries", b =>
|
||||
{
|
||||
b.Navigation("Media")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("MediaSeriesSeasons");
|
||||
});
|
||||
|
||||
@@ -9,7 +9,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
namespace WatchIt.Database.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class _0000_Initial : Migration
|
||||
public partial class _0001_Initial : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
@@ -34,7 +34,8 @@ namespace WatchIt.Database.Migrations
|
||||
{
|
||||
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)
|
||||
Name = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
|
||||
IsHistorical = table.Column<bool>(type: "boolean", nullable: false, defaultValue: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
@@ -42,7 +43,7 @@ namespace WatchIt.Database.Migrations
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Gender",
|
||||
name: "Genders",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<short>(type: "smallint", nullable: false)
|
||||
@@ -51,7 +52,7 @@ namespace WatchIt.Database.Migrations
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Gender", x => x.Id);
|
||||
table.PrimaryKey("PK_Genders", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
@@ -61,26 +62,13 @@ namespace WatchIt.Database.Migrations
|
||||
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)
|
||||
Description = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Genres", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "MediaMovies",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Budget = table.Column<decimal>(type: "money", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MediaMovies", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "MediaPosterImages",
|
||||
columns: table => new
|
||||
@@ -95,19 +83,6 @@ namespace WatchIt.Database.Migrations
|
||||
table.PrimaryKey("PK_MediaPosterImages", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "MediaSeries",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
HasEnded = table.Column<bool>(type: "boolean", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MediaSeries", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "PersonActorRoleTypes",
|
||||
columns: table => new
|
||||
@@ -152,54 +127,23 @@ namespace WatchIt.Database.Migrations
|
||||
name: "Media",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<long>(type: "bigint", nullable: false),
|
||||
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),
|
||||
ReleaseDate = table.Column<DateOnly>(type: "date", nullable: true),
|
||||
Length = table.Column<short>(type: "smallint", nullable: true),
|
||||
MediaPosterImageId = table.Column<Guid>(type: "uuid", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Media", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Media_MediaMovies_Id",
|
||||
column: x => x.Id,
|
||||
principalTable: "MediaMovies",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_Media_MediaPosterImages_MediaPosterImageId",
|
||||
column: x => x.MediaPosterImageId,
|
||||
principalTable: "MediaPosterImages",
|
||||
principalColumn: "Id");
|
||||
table.ForeignKey(
|
||||
name: "FK_Media_MediaSeries_Id",
|
||||
column: x => x.Id,
|
||||
principalTable: "MediaSeries",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "MediaSeriesSeasons",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
MediaSeriesId = table.Column<long>(type: "bigint", nullable: false),
|
||||
Number = table.Column<short>(type: "smallint", nullable: false),
|
||||
Name = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MediaSeriesSeasons", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_MediaSeriesSeasons_MediaSeries_MediaSeriesId",
|
||||
column: x => x.MediaSeriesId,
|
||||
principalTable: "MediaSeries",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
@@ -213,18 +157,17 @@ namespace WatchIt.Database.Migrations
|
||||
Description = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: true),
|
||||
BirthDate = table.Column<DateOnly>(type: "date", nullable: true),
|
||||
DeathDate = table.Column<DateOnly>(type: "date", nullable: true),
|
||||
GenderId = table.Column<short>(type: "smallint", nullable: false),
|
||||
GenderId = table.Column<short>(type: "smallint", nullable: true),
|
||||
PersonPhotoId = table.Column<Guid>(type: "uuid", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Persons", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Persons_Gender_GenderId",
|
||||
name: "FK_Persons_Genders_GenderId",
|
||||
column: x => x.GenderId,
|
||||
principalTable: "Gender",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
principalTable: "Genders",
|
||||
principalColumn: "Id");
|
||||
table.ForeignKey(
|
||||
name: "FK_Persons_PersonPhotoImages_PersonPhotoId",
|
||||
column: x => x.PersonPhotoId,
|
||||
@@ -256,6 +199,24 @@ namespace WatchIt.Database.Migrations
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "MediaMovies",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<long>(type: "bigint", nullable: false),
|
||||
Budget = table.Column<decimal>(type: "money", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MediaMovies", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_MediaMovies_Media_Id",
|
||||
column: x => x.Id,
|
||||
principalTable: "Media",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "MediaPhotoImages",
|
||||
columns: table => new
|
||||
@@ -304,22 +265,39 @@ namespace WatchIt.Database.Migrations
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "MediaSeriesEpisodes",
|
||||
name: "MediaSeries",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
MediaSeriesSeasonId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
Number = table.Column<short>(type: "smallint", nullable: false),
|
||||
Name = table.Column<string>(type: "text", nullable: true),
|
||||
IsSpecial = table.Column<bool>(type: "boolean", nullable: false, defaultValue: false)
|
||||
Id = table.Column<long>(type: "bigint", nullable: false),
|
||||
HasEnded = table.Column<bool>(type: "boolean", nullable: false, defaultValue: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MediaSeriesEpisodes", x => x.Id);
|
||||
table.PrimaryKey("PK_MediaSeries", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_MediaSeriesEpisodes_MediaSeriesSeasons_MediaSeriesSeasonId",
|
||||
column: x => x.MediaSeriesSeasonId,
|
||||
principalTable: "MediaSeriesSeasons",
|
||||
name: "FK_MediaSeries_Media_Id",
|
||||
column: x => x.Id,
|
||||
principalTable: "Media",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ViewCountsMedia",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
MediaId = table.Column<long>(type: "bigint", nullable: false),
|
||||
Date = table.Column<DateOnly>(type: "date", nullable: false, defaultValueSql: "now()"),
|
||||
ViewCount = table.Column<long>(type: "bigint", nullable: false, defaultValue: 0L)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ViewCountsMedia", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ViewCountsMedia_Media_MediaId",
|
||||
column: x => x.MediaId,
|
||||
principalTable: "Media",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
@@ -389,6 +367,26 @@ namespace WatchIt.Database.Migrations
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ViewCountsPerson",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
PersonId = table.Column<long>(type: "bigint", nullable: false),
|
||||
Date = table.Column<DateOnly>(type: "date", nullable: false, defaultValueSql: "now()"),
|
||||
ViewCount = table.Column<long>(type: "bigint", nullable: false, defaultValue: 0L)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ViewCountsPerson", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ViewCountsPerson_Persons_PersonId",
|
||||
column: x => x.PersonId,
|
||||
principalTable: "Persons",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Accounts",
|
||||
columns: table => new
|
||||
@@ -397,14 +395,14 @@ namespace WatchIt.Database.Migrations
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Username = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
|
||||
Email = table.Column<string>(type: "character varying(320)", maxLength: 320, nullable: false),
|
||||
Description = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: false),
|
||||
GenderId = table.Column<short>(type: "smallint", nullable: false),
|
||||
Description = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: true),
|
||||
GenderId = table.Column<short>(type: "smallint", nullable: true),
|
||||
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),
|
||||
IsAdmin = table.Column<bool>(type: "boolean", nullable: false, defaultValue: 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()")
|
||||
},
|
||||
@@ -417,11 +415,10 @@ namespace WatchIt.Database.Migrations
|
||||
principalTable: "AccountProfilePictures",
|
||||
principalColumn: "Id");
|
||||
table.ForeignKey(
|
||||
name: "FK_Accounts_Gender_GenderId",
|
||||
name: "FK_Accounts_Genders_GenderId",
|
||||
column: x => x.GenderId,
|
||||
principalTable: "Gender",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
principalTable: "Genders",
|
||||
principalColumn: "Id");
|
||||
table.ForeignKey(
|
||||
name: "FK_Accounts_MediaPhotoImages_BackgroundPictureId",
|
||||
column: x => x.BackgroundPictureId,
|
||||
@@ -429,6 +426,46 @@ namespace WatchIt.Database.Migrations
|
||||
principalColumn: "Id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "MediaSeriesSeasons",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
MediaSeriesId = table.Column<long>(type: "bigint", nullable: false),
|
||||
Number = table.Column<short>(type: "smallint", nullable: false),
|
||||
Name = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MediaSeriesSeasons", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_MediaSeriesSeasons_MediaSeries_MediaSeriesId",
|
||||
column: x => x.MediaSeriesId,
|
||||
principalTable: "MediaSeries",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AccountRefreshTokens",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
AccountId = table.Column<long>(type: "bigint", nullable: false),
|
||||
ExpirationDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
IsExtendable = table.Column<bool>(type: "boolean", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AccountRefreshTokens", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_AccountRefreshTokens_Accounts_AccountId",
|
||||
column: x => x.AccountId,
|
||||
principalTable: "Accounts",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "RatingsMedia",
|
||||
columns: table => new
|
||||
@@ -455,58 +492,6 @@ namespace WatchIt.Database.Migrations
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "RatingsMediaSeriesEpisode",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
MediaSeriesEpisodeId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
AccountId = table.Column<long>(type: "bigint", nullable: false),
|
||||
Rating = table.Column<short>(type: "smallint", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_RatingsMediaSeriesEpisode", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_RatingsMediaSeriesEpisode_Accounts_AccountId",
|
||||
column: x => x.AccountId,
|
||||
principalTable: "Accounts",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_RatingsMediaSeriesEpisode_MediaSeriesEpisodes_MediaSeriesEp~",
|
||||
column: x => x.MediaSeriesEpisodeId,
|
||||
principalTable: "MediaSeriesEpisodes",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "RatingsMediaSeriesSeason",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
MediaSeriesSeasonId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
AccountId = table.Column<long>(type: "bigint", nullable: false),
|
||||
Rating = table.Column<short>(type: "smallint", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_RatingsMediaSeriesSeason", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_RatingsMediaSeriesSeason_Accounts_AccountId",
|
||||
column: x => x.AccountId,
|
||||
principalTable: "Accounts",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_RatingsMediaSeriesSeason_MediaSeriesSeasons_MediaSeriesSeas~",
|
||||
column: x => x.MediaSeriesSeasonId,
|
||||
principalTable: "MediaSeriesSeasons",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "RatingsPersonActorRole",
|
||||
columns: table => new
|
||||
@@ -559,6 +544,84 @@ namespace WatchIt.Database.Migrations
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "MediaSeriesEpisodes",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
MediaSeriesSeasonId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
Number = table.Column<short>(type: "smallint", nullable: false),
|
||||
Name = table.Column<string>(type: "text", nullable: true),
|
||||
IsSpecial = table.Column<bool>(type: "boolean", nullable: false, defaultValue: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MediaSeriesEpisodes", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_MediaSeriesEpisodes_MediaSeriesSeasons_MediaSeriesSeasonId",
|
||||
column: x => x.MediaSeriesSeasonId,
|
||||
principalTable: "MediaSeriesSeasons",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "RatingsMediaSeriesSeason",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
MediaSeriesSeasonId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
AccountId = table.Column<long>(type: "bigint", nullable: false),
|
||||
Rating = table.Column<short>(type: "smallint", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_RatingsMediaSeriesSeason", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_RatingsMediaSeriesSeason_Accounts_AccountId",
|
||||
column: x => x.AccountId,
|
||||
principalTable: "Accounts",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_RatingsMediaSeriesSeason_MediaSeriesSeasons_MediaSeriesSeas~",
|
||||
column: x => x.MediaSeriesSeasonId,
|
||||
principalTable: "MediaSeriesSeasons",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "RatingsMediaSeriesEpisode",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
MediaSeriesEpisodeId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
AccountId = table.Column<long>(type: "bigint", nullable: false),
|
||||
Rating = table.Column<short>(type: "smallint", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_RatingsMediaSeriesEpisode", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_RatingsMediaSeriesEpisode_Accounts_AccountId",
|
||||
column: x => x.AccountId,
|
||||
principalTable: "Accounts",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_RatingsMediaSeriesEpisode_MediaSeriesEpisodes_MediaSeriesEp~",
|
||||
column: x => x.MediaSeriesEpisodeId,
|
||||
principalTable: "MediaSeriesEpisodes",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "Accounts",
|
||||
columns: new[] { "Id", "BackgroundPictureId", "Description", "Email", "GenderId", "IsAdmin", "LeftSalt", "Password", "ProfilePictureId", "RightSalt", "Username" },
|
||||
values: new object[] { 1L, null, null, "root@watch.it", null, true, "qE]Q^g%tU\"6Uu^GfE:V:", new byte[] { 165, 250, 135, 31, 187, 161, 15, 246, 18, 232, 64, 25, 37, 173, 91, 111, 140, 177, 183, 84, 254, 177, 15, 235, 119, 219, 29, 169, 32, 108, 187, 121, 204, 51, 213, 28, 141, 89, 91, 226, 0, 23, 7, 91, 139, 230, 151, 104, 62, 91, 59, 6, 207, 26, 200, 141, 104, 5, 151, 201, 243, 163, 28, 248 }, null, "T7j)~.#%~ZtOFUZFK,K+", "root" });
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "Countries",
|
||||
columns: new[] { "Id", "Name" },
|
||||
@@ -568,6 +631,15 @@ namespace WatchIt.Database.Migrations
|
||||
{ (short)2, "Albania" }
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "Genders",
|
||||
columns: new[] { "Id", "Name" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ (short)1, "Male" },
|
||||
{ (short)2, "Female" }
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "Genres",
|
||||
columns: new[] { "Id", "Description", "Name" },
|
||||
@@ -606,6 +678,17 @@ namespace WatchIt.Database.Migrations
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AccountRefreshTokens_AccountId",
|
||||
table: "AccountRefreshTokens",
|
||||
column: "AccountId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AccountRefreshTokens_Id",
|
||||
table: "AccountRefreshTokens",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Accounts_BackgroundPictureId",
|
||||
table: "Accounts",
|
||||
@@ -634,6 +717,12 @@ namespace WatchIt.Database.Migrations
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Genders_Id",
|
||||
table: "Genders",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Genres_Id",
|
||||
table: "Genres",
|
||||
@@ -869,14 +958,42 @@ namespace WatchIt.Database.Migrations
|
||||
name: "IX_RatingsPersonCreatorRole_PersonCreatorRoleId",
|
||||
table: "RatingsPersonCreatorRole",
|
||||
column: "PersonCreatorRoleId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ViewCountsMedia_Id",
|
||||
table: "ViewCountsMedia",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ViewCountsMedia_MediaId",
|
||||
table: "ViewCountsMedia",
|
||||
column: "MediaId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ViewCountsPerson_Id",
|
||||
table: "ViewCountsPerson",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ViewCountsPerson_PersonId",
|
||||
table: "ViewCountsPerson",
|
||||
column: "PersonId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "AccountRefreshTokens");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "MediaGenres");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "MediaMovies");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "MediaProductionCountrys");
|
||||
|
||||
@@ -895,6 +1012,12 @@ namespace WatchIt.Database.Migrations
|
||||
migrationBuilder.DropTable(
|
||||
name: "RatingsPersonCreatorRole");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ViewCountsMedia");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ViewCountsPerson");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Genres");
|
||||
|
||||
@@ -932,22 +1055,19 @@ namespace WatchIt.Database.Migrations
|
||||
name: "Persons");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Media");
|
||||
name: "MediaSeries");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Gender");
|
||||
name: "Genders");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "PersonPhotoImages");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "MediaMovies");
|
||||
name: "Media");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "MediaPosterImages");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "MediaSeries");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,10 @@ namespace WatchIt.Database.Migrations
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.3")
|
||||
.HasAnnotation("ProductVersion", "8.0.4")
|
||||
.HasAnnotation("Proxies:ChangeTracking", false)
|
||||
.HasAnnotation("Proxies:CheckEquality", false)
|
||||
.HasAnnotation("Proxies:LazyLoading", true)
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
@@ -96,6 +99,20 @@ namespace WatchIt.Database.Migrations
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Accounts");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1L,
|
||||
CreationDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
Email = "root@watch.it",
|
||||
IsAdmin = true,
|
||||
LastActive = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
LeftSalt = "qE]Q^g%tU\"6Uu^GfE:V:",
|
||||
Password = new byte[] { 165, 250, 135, 31, 187, 161, 15, 246, 18, 232, 64, 25, 37, 173, 91, 111, 140, 177, 183, 84, 254, 177, 15, 235, 119, 219, 29, 169, 32, 108, 187, 121, 204, 51, 213, 28, 141, 89, 91, 226, 0, 23, 7, 91, 139, 230, 151, 104, 62, 91, 59, 6, 207, 26, 200, 141, 104, 5, 151, 201, 243, 163, 28, 248 },
|
||||
RightSalt = "T7j)~.#%~ZtOFUZFK,K+",
|
||||
Username = "root"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Account.AccountProfilePicture", b =>
|
||||
@@ -160,6 +177,11 @@ namespace WatchIt.Database.Migrations
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<short>("Id"));
|
||||
|
||||
b.Property<bool>("IsHistorical")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("boolean")
|
||||
.HasDefaultValue(false);
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
@@ -176,11 +198,13 @@ namespace WatchIt.Database.Migrations
|
||||
new
|
||||
{
|
||||
Id = (short)1,
|
||||
IsHistorical = false,
|
||||
Name = "Afghanistan"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = (short)2,
|
||||
IsHistorical = false,
|
||||
Name = "Albania"
|
||||
});
|
||||
});
|
||||
@@ -226,8 +250,7 @@ namespace WatchIt.Database.Migrations
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<short>("Id"));
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("character varying(1000)");
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
@@ -272,14 +295,17 @@ namespace WatchIt.Database.Migrations
|
||||
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<short?>("Length")
|
||||
.HasColumnType("smallint");
|
||||
|
||||
b.Property<Guid?>("MediaPosterImageId")
|
||||
.HasColumnType("uuid");
|
||||
@@ -288,8 +314,8 @@ namespace WatchIt.Database.Migrations
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("character varying(250)");
|
||||
|
||||
b.Property<DateTime?>("ReleaseDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
b.Property<DateOnly?>("ReleaseDate")
|
||||
.HasColumnType("date");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
@@ -325,11 +351,8 @@ namespace WatchIt.Database.Migrations
|
||||
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");
|
||||
|
||||
@@ -432,13 +455,12 @@ namespace WatchIt.Database.Migrations
|
||||
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");
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("boolean")
|
||||
.HasDefaultValue(false);
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
@@ -525,7 +547,7 @@ namespace WatchIt.Database.Migrations
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("character varying(200)");
|
||||
|
||||
b.Property<short>("GenderId")
|
||||
b.Property<short?>("GenderId")
|
||||
.HasColumnType("smallint");
|
||||
|
||||
b.Property<string>("Name")
|
||||
@@ -943,18 +965,6 @@ namespace WatchIt.Database.Migrations
|
||||
|
||||
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");
|
||||
@@ -981,6 +991,17 @@ namespace WatchIt.Database.Migrations
|
||||
b.Navigation("Media");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaMovie", b =>
|
||||
{
|
||||
b.HasOne("WatchIt.Database.Model.Media.Media", "Media")
|
||||
.WithOne()
|
||||
.HasForeignKey("WatchIt.Database.Model.Media.MediaMovie", "Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Media");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaPhotoImage", b =>
|
||||
{
|
||||
b.HasOne("WatchIt.Database.Model.Media.Media", "Media")
|
||||
@@ -1011,6 +1032,17 @@ namespace WatchIt.Database.Migrations
|
||||
b.Navigation("Media");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeries", b =>
|
||||
{
|
||||
b.HasOne("WatchIt.Database.Model.Media.Media", "Media")
|
||||
.WithOne()
|
||||
.HasForeignKey("WatchIt.Database.Model.Media.MediaSeries", "Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Media");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeriesEpisode", b =>
|
||||
{
|
||||
b.HasOne("WatchIt.Database.Model.Media.MediaSeriesSeason", "MediaSeriesSeason")
|
||||
@@ -1037,9 +1069,7 @@ namespace WatchIt.Database.Migrations
|
||||
{
|
||||
b.HasOne("WatchIt.Database.Model.Common.Gender", "Gender")
|
||||
.WithMany()
|
||||
.HasForeignKey("GenderId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
.HasForeignKey("GenderId");
|
||||
|
||||
b.HasOne("WatchIt.Database.Model.Person.PersonPhotoImage", "PersonPhoto")
|
||||
.WithOne("Person")
|
||||
@@ -1269,12 +1299,6 @@ namespace WatchIt.Database.Migrations
|
||||
b.Navigation("ViewCountsMedia");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaMovie", b =>
|
||||
{
|
||||
b.Navigation("Media")
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaPosterImage", b =>
|
||||
{
|
||||
b.Navigation("Media")
|
||||
@@ -1283,9 +1307,6 @@ namespace WatchIt.Database.Migrations
|
||||
|
||||
modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeries", b =>
|
||||
{
|
||||
b.Navigation("Media")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("MediaSeriesSeasons");
|
||||
});
|
||||
|
||||
|
||||
@@ -1,31 +1,32 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.3" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="8.0.3" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Analyzers" Version="8.0.3" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.3">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="8.0.3" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.3">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Npgsql" Version="8.0.2" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.2" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL.Design" Version="1.1.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="8.0.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Analyzers" Version="8.0.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.4">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="8.0.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="8.0.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.4">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.2" />
|
||||
<PackageReference Include="SimpleToolkit.Extensions" Version="1.7.5" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\WatchIt.Database.Model\WatchIt.Database.Model.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\WatchIt.Database.Model\WatchIt.Database.Model.Configuration\WatchIt.Database.Model.Configuration.csproj" />
|
||||
<ProjectReference Include="..\WatchIt.Database.Model\WatchIt.Database.Model\WatchIt.Database.Model.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user