diff --git a/FreeTubeSync/Migrations/20250731174538_AddChangeLogTracking.Designer.cs b/FreeTubeSync/Migrations/20250731174538_AddChangeLogTracking.Designer.cs new file mode 100644 index 0000000..2e42fc8 --- /dev/null +++ b/FreeTubeSync/Migrations/20250731174538_AddChangeLogTracking.Designer.cs @@ -0,0 +1,269 @@ +// +using System; +using FreeTubeSync.Database; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace FreeTubeSync.Migrations +{ + [DbContext(typeof(DataContext))] + [Migration("20250731174538_AddChangeLogTracking")] + partial class AddChangeLogTracking + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "9.0.7"); + + modelBuilder.Entity("FreeTubeSync.Model.Database.ChangeLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ChangeTime") + .HasColumnType("TEXT"); + + b.Property("ChangeType") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("TableName") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("ChangeLogs"); + }); + + modelBuilder.Entity("FreeTubeSync.Model.Database.History", b => + { + b.Property("_id") + .HasColumnType("TEXT"); + + b.Property("author") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("authorId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("description") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("isLive") + .HasColumnType("INTEGER"); + + b.Property("lastViewedPlaylistItemId") + .HasColumnType("TEXT"); + + b.Property("lastViewedPlaylistType") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("lengthSeconds") + .HasColumnType("INTEGER"); + + b.Property("published") + .HasColumnType("INTEGER"); + + b.Property("timeWatched") + .HasColumnType("INTEGER"); + + b.Property("title") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("type") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("videoId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("viewCount") + .HasColumnType("INTEGER"); + + b.Property("watchProgress") + .HasColumnType("REAL"); + + b.HasKey("_id"); + + b.ToTable("Histories"); + }); + + modelBuilder.Entity("FreeTubeSync.Model.Database.Playlist", b => + { + b.Property("_id") + .HasColumnType("TEXT"); + + b.Property("createdAt") + .HasColumnType("INTEGER"); + + b.Property("lastUpdatedAt") + .HasColumnType("INTEGER"); + + b.Property("playlistName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("protected") + .HasColumnType("INTEGER"); + + b.HasKey("_id"); + + b.ToTable("Playlists"); + }); + + modelBuilder.Entity("FreeTubeSync.Model.Database.Profile", b => + { + b.Property("_id") + .HasColumnType("TEXT"); + + b.Property("bgColor") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("textColor") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("_id"); + + b.ToTable("Profiles"); + }); + + modelBuilder.Entity("FreeTubeSync.Model.Database.SearchHistory", b => + { + b.Property("_id") + .HasColumnType("TEXT"); + + b.Property("lastUpdatedAt") + .HasColumnType("INTEGER"); + + b.HasKey("_id"); + + b.ToTable("SearchHistories"); + }); + + modelBuilder.Entity("FreeTubeSync.Model.Database.Setting", b => + { + b.Property("_id") + .HasColumnType("TEXT"); + + b.Property("value") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("_id"); + + b.ToTable("Settings"); + }); + + modelBuilder.Entity("FreeTubeSync.Model.Database.Subscription", b => + { + b.Property("id") + .HasColumnType("TEXT"); + + b.Property("Profile_id") + .HasColumnType("TEXT"); + + b.Property("name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("thumbnail") + .HasColumnType("TEXT"); + + b.HasKey("id"); + + b.HasIndex("Profile_id"); + + b.ToTable("Subscriptions"); + }); + + modelBuilder.Entity("FreeTubeSync.Model.Database.Video", b => + { + b.Property("playlistItemId") + .HasColumnType("TEXT"); + + b.Property("Playlist_id") + .HasColumnType("TEXT"); + + b.Property("author") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("authorId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("lengthSeconds") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("pubished") + .HasColumnType("INTEGER"); + + b.Property("timeAdded") + .HasColumnType("INTEGER"); + + b.Property("title") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("type") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("videoId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("playlistItemId"); + + b.HasIndex("Playlist_id"); + + b.ToTable("Videos"); + }); + + modelBuilder.Entity("FreeTubeSync.Model.Database.Subscription", b => + { + b.HasOne("FreeTubeSync.Model.Database.Profile", null) + .WithMany("subscriptions") + .HasForeignKey("Profile_id"); + }); + + modelBuilder.Entity("FreeTubeSync.Model.Database.Video", b => + { + b.HasOne("FreeTubeSync.Model.Database.Playlist", null) + .WithMany("videos") + .HasForeignKey("Playlist_id"); + }); + + modelBuilder.Entity("FreeTubeSync.Model.Database.Playlist", b => + { + b.Navigation("videos"); + }); + + modelBuilder.Entity("FreeTubeSync.Model.Database.Profile", b => + { + b.Navigation("subscriptions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/FreeTubeSync/Migrations/20250731174538_AddChangeLogTracking.cs b/FreeTubeSync/Migrations/20250731174538_AddChangeLogTracking.cs new file mode 100644 index 0000000..b4b2ddd --- /dev/null +++ b/FreeTubeSync/Migrations/20250731174538_AddChangeLogTracking.cs @@ -0,0 +1,37 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace FreeTubeSync.Migrations +{ + /// + public partial class AddChangeLogTracking : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "ChangeLogs", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + TableName = table.Column(type: "TEXT", nullable: false), + ChangeType = table.Column(type: "TEXT", nullable: false), + ChangeTime = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ChangeLogs", x => x.Id); + }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "ChangeLogs"); + } + } +} diff --git a/FreeTubeSync/Migrations/DataContextModelSnapshot.cs b/FreeTubeSync/Migrations/DataContextModelSnapshot.cs index ae411d3..0076d0a 100644 --- a/FreeTubeSync/Migrations/DataContextModelSnapshot.cs +++ b/FreeTubeSync/Migrations/DataContextModelSnapshot.cs @@ -1,4 +1,5 @@ // +using System; using FreeTubeSync.Database; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; @@ -16,6 +17,28 @@ namespace FreeTubeSync.Migrations #pragma warning disable 612, 618 modelBuilder.HasAnnotation("ProductVersion", "9.0.7"); + modelBuilder.Entity("FreeTubeSync.Model.Database.ChangeLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ChangeTime") + .HasColumnType("TEXT"); + + b.Property("ChangeType") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("TableName") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("ChangeLogs"); + }); + modelBuilder.Entity("FreeTubeSync.Model.Database.History", b => { b.Property("_id")