//
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using TransmissionRssManager.Data;
#nullable disable
namespace TransmissionRssManager.Migrations
{
[DbContext(typeof(TorrentManagerContext))]
[Migration("20250312193828_InitialCreate")]
partial class InitialCreate
{
///
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.17")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("TransmissionRssManager.Data.Models.RssFeed", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("Enabled")
.HasColumnType("boolean");
b.Property("LastCheckedAt")
.HasColumnType("timestamp with time zone");
b.Property("LastError")
.HasColumnType("text");
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.Property("RefreshInterval")
.HasColumnType("integer");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property("Url")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("RssFeeds");
});
modelBuilder.Entity("TransmissionRssManager.Data.Models.RssFeedItem", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Description")
.HasColumnType("text");
b.Property("DiscoveredAt")
.HasColumnType("timestamp with time zone");
b.Property("DownloadError")
.HasColumnType("text");
b.Property("DownloadedAt")
.HasColumnType("timestamp with time zone");
b.Property("IsDownloaded")
.HasColumnType("boolean");
b.Property("Link")
.IsRequired()
.HasColumnType("text");
b.Property("MatchedRuleId")
.HasColumnType("integer");
b.Property("PublishDate")
.HasColumnType("timestamp with time zone");
b.Property("RssFeedId")
.HasColumnType("integer");
b.Property("Title")
.IsRequired()
.HasColumnType("text");
b.Property("TorrentId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("MatchedRuleId");
b.HasIndex("RssFeedId", "Link")
.IsUnique();
b.ToTable("RssFeedItems");
});
modelBuilder.Entity("TransmissionRssManager.Data.Models.RssFeedRule", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CustomSavePath")
.HasColumnType("text");
b.Property("EnablePostProcessing")
.HasColumnType("boolean");
b.Property("Enabled")
.HasColumnType("boolean");
b.Property("ExcludePattern")
.HasColumnType("text");
b.Property("IncludePattern")
.HasColumnType("text");
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.Property("Priority")
.HasColumnType("integer");
b.Property("RssFeedId")
.HasColumnType("integer");
b.Property("SaveToCustomPath")
.HasColumnType("boolean");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property("UseRegex")
.HasColumnType("boolean");
b.HasKey("Id");
b.HasIndex("RssFeedId");
b.ToTable("RssFeedRules");
});
modelBuilder.Entity("TransmissionRssManager.Data.Models.Torrent", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("AddedOn")
.HasColumnType("timestamp with time zone");
b.Property("CompletedOn")
.HasColumnType("timestamp with time zone");
b.Property("DownloadDirectory")
.HasColumnType("text");
b.Property("ErrorMessage")
.HasColumnType("text");
b.Property("Hash")
.IsRequired()
.HasColumnType("text");
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.Property("PercentDone")
.HasColumnType("double precision");
b.Property("PostProcessed")
.HasColumnType("boolean");
b.Property("PostProcessedOn")
.HasColumnType("timestamp with time zone");
b.Property("RssFeedItemId")
.HasColumnType("integer");
b.Property("Status")
.IsRequired()
.HasColumnType("text");
b.Property("TotalSize")
.HasColumnType("bigint");
b.Property("TransmissionId")
.HasColumnType("integer");
b.Property("UploadRatio")
.HasColumnType("double precision");
b.HasKey("Id");
b.HasIndex("Hash")
.IsUnique();
b.HasIndex("RssFeedItemId")
.IsUnique();
b.ToTable("Torrents");
});
modelBuilder.Entity("TransmissionRssManager.Data.Models.UserPreference", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Category")
.HasColumnType("text");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("DataType")
.HasColumnType("text");
b.Property("Description")
.HasColumnType("text");
b.Property("Key")
.IsRequired()
.HasColumnType("text");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property("Value")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("Key")
.IsUnique();
b.ToTable("UserPreferences");
});
modelBuilder.Entity("TransmissionRssManager.Data.Models.RssFeedItem", b =>
{
b.HasOne("TransmissionRssManager.Data.Models.RssFeedRule", "MatchedRule")
.WithMany("MatchedItems")
.HasForeignKey("MatchedRuleId")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("TransmissionRssManager.Data.Models.RssFeed", "RssFeed")
.WithMany("Items")
.HasForeignKey("RssFeedId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("MatchedRule");
b.Navigation("RssFeed");
});
modelBuilder.Entity("TransmissionRssManager.Data.Models.RssFeedRule", b =>
{
b.HasOne("TransmissionRssManager.Data.Models.RssFeed", "RssFeed")
.WithMany("Rules")
.HasForeignKey("RssFeedId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("RssFeed");
});
modelBuilder.Entity("TransmissionRssManager.Data.Models.Torrent", b =>
{
b.HasOne("TransmissionRssManager.Data.Models.RssFeedItem", "RssFeedItem")
.WithOne("Torrent")
.HasForeignKey("TransmissionRssManager.Data.Models.Torrent", "RssFeedItemId")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("RssFeedItem");
});
modelBuilder.Entity("TransmissionRssManager.Data.Models.RssFeed", b =>
{
b.Navigation("Items");
b.Navigation("Rules");
});
modelBuilder.Entity("TransmissionRssManager.Data.Models.RssFeedItem", b =>
{
b.Navigation("Torrent");
});
modelBuilder.Entity("TransmissionRssManager.Data.Models.RssFeedRule", b =>
{
b.Navigation("MatchedItems");
});
#pragma warning restore 612, 618
}
}
}