Updated Migrations
Updated Migrations to handle change of Int to Long (SQLite still uses integer field, but better safe if using something other then SQLite) Changed Primary Key for Video from VideoId to PlaylistItemId.
This commit is contained in:
parent
6970b792eb
commit
8e11008d58
5 changed files with 565 additions and 14 deletions
247
FreeTubeSync/Migrations/20250719172349_UpdateIntToLong.Designer.cs
generated
Normal file
247
FreeTubeSync/Migrations/20250719172349_UpdateIntToLong.Designer.cs
generated
Normal file
|
|
@ -0,0 +1,247 @@
|
|||
// <auto-generated />
|
||||
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("20250719172349_UpdateIntToLong")]
|
||||
partial class UpdateIntToLong
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "9.0.7");
|
||||
|
||||
modelBuilder.Entity("FreeTubeSync.Model.History", b =>
|
||||
{
|
||||
b.Property<string>("_id")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("author")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("authorId")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("description")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("isLive")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("lastViewedPlaylistItemId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("lastViewedPlaylistType")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<long>("lengthSeconds")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<long>("published")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<long>("timeWatched")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("title")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("type")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("videoId")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<long>("viewCount")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<float>("watchProgress")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.HasKey("_id");
|
||||
|
||||
b.ToTable("Histories");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FreeTubeSync.Model.Playlist", b =>
|
||||
{
|
||||
b.Property<string>("_id")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<long>("createdAt")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<long>("lastUpdatedAt")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("playlistName")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("protected")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("_id");
|
||||
|
||||
b.ToTable("Playlists", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FreeTubeSync.Model.Profile", b =>
|
||||
{
|
||||
b.Property<string>("_id")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("bgColor")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("name")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("textColor")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("_id");
|
||||
|
||||
b.ToTable("Profiles", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FreeTubeSync.Model.SearchHistory", b =>
|
||||
{
|
||||
b.Property<string>("_id")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<long>("lastUpdatedAt")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("_id");
|
||||
|
||||
b.ToTable("SearchHistories");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FreeTubeSync.Model.Setting", b =>
|
||||
{
|
||||
b.Property<string>("_id")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("ValueJson")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnName("Value");
|
||||
|
||||
b.HasKey("_id");
|
||||
|
||||
b.ToTable("Settings", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FreeTubeSync.Model.Subscription", b =>
|
||||
{
|
||||
b.Property<string>("id")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Profile_id")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("name")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("thumbnail")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("id");
|
||||
|
||||
b.HasIndex("Profile_id");
|
||||
|
||||
b.ToTable("Subscriptions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FreeTubeSync.Model.Video", b =>
|
||||
{
|
||||
b.Property<string>("videoId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Playlist_id")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("author")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("authorId")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("lengthSeconds")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("playlistItemId")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<long>("pubished")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<long>("timeAdded")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("title")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("type")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("videoId");
|
||||
|
||||
b.HasIndex("Playlist_id");
|
||||
|
||||
b.ToTable("Videos");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FreeTubeSync.Model.Subscription", b =>
|
||||
{
|
||||
b.HasOne("FreeTubeSync.Model.Profile", null)
|
||||
.WithMany("subscriptions")
|
||||
.HasForeignKey("Profile_id");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FreeTubeSync.Model.Video", b =>
|
||||
{
|
||||
b.HasOne("FreeTubeSync.Model.Playlist", null)
|
||||
.WithMany("videos")
|
||||
.HasForeignKey("Playlist_id");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FreeTubeSync.Model.Playlist", b =>
|
||||
{
|
||||
b.Navigation("videos");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FreeTubeSync.Model.Profile", b =>
|
||||
{
|
||||
b.Navigation("subscriptions");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
22
FreeTubeSync/Migrations/20250719172349_UpdateIntToLong.cs
Normal file
22
FreeTubeSync/Migrations/20250719172349_UpdateIntToLong.cs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace FreeTubeSync.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class UpdateIntToLong : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
247
FreeTubeSync/Migrations/20250719172939_ChangePrimaryKeyToPlaylistItemId.Designer.cs
generated
Normal file
247
FreeTubeSync/Migrations/20250719172939_ChangePrimaryKeyToPlaylistItemId.Designer.cs
generated
Normal file
|
|
@ -0,0 +1,247 @@
|
|||
// <auto-generated />
|
||||
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("20250719172939_ChangePrimaryKeyToPlaylistItemId")]
|
||||
partial class ChangePrimaryKeyToPlaylistItemId
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "9.0.7");
|
||||
|
||||
modelBuilder.Entity("FreeTubeSync.Model.History", b =>
|
||||
{
|
||||
b.Property<string>("_id")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("author")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("authorId")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("description")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("isLive")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("lastViewedPlaylistItemId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("lastViewedPlaylistType")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<long>("lengthSeconds")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<long>("published")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<long>("timeWatched")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("title")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("type")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("videoId")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<long>("viewCount")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<float>("watchProgress")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.HasKey("_id");
|
||||
|
||||
b.ToTable("Histories");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FreeTubeSync.Model.Playlist", b =>
|
||||
{
|
||||
b.Property<string>("_id")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<long>("createdAt")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<long>("lastUpdatedAt")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("playlistName")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("protected")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("_id");
|
||||
|
||||
b.ToTable("Playlists", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FreeTubeSync.Model.Profile", b =>
|
||||
{
|
||||
b.Property<string>("_id")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("bgColor")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("name")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("textColor")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("_id");
|
||||
|
||||
b.ToTable("Profiles", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FreeTubeSync.Model.SearchHistory", b =>
|
||||
{
|
||||
b.Property<string>("_id")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<long>("lastUpdatedAt")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("_id");
|
||||
|
||||
b.ToTable("SearchHistories");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FreeTubeSync.Model.Setting", b =>
|
||||
{
|
||||
b.Property<string>("_id")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("ValueJson")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnName("Value");
|
||||
|
||||
b.HasKey("_id");
|
||||
|
||||
b.ToTable("Settings", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FreeTubeSync.Model.Subscription", b =>
|
||||
{
|
||||
b.Property<string>("id")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Profile_id")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("name")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("thumbnail")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("id");
|
||||
|
||||
b.HasIndex("Profile_id");
|
||||
|
||||
b.ToTable("Subscriptions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FreeTubeSync.Model.Video", b =>
|
||||
{
|
||||
b.Property<string>("playlistItemId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Playlist_id")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("author")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("authorId")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("lengthSeconds")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<long>("pubished")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<long>("timeAdded")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("title")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("type")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("videoId")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("playlistItemId");
|
||||
|
||||
b.HasIndex("Playlist_id");
|
||||
|
||||
b.ToTable("Videos");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FreeTubeSync.Model.Subscription", b =>
|
||||
{
|
||||
b.HasOne("FreeTubeSync.Model.Profile", null)
|
||||
.WithMany("subscriptions")
|
||||
.HasForeignKey("Profile_id");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FreeTubeSync.Model.Video", b =>
|
||||
{
|
||||
b.HasOne("FreeTubeSync.Model.Playlist", null)
|
||||
.WithMany("videos")
|
||||
.HasForeignKey("Playlist_id");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FreeTubeSync.Model.Playlist", b =>
|
||||
{
|
||||
b.Navigation("videos");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FreeTubeSync.Model.Profile", b =>
|
||||
{
|
||||
b.Navigation("subscriptions");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace FreeTubeSync.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class ChangePrimaryKeyToPlaylistItemId : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_Videos",
|
||||
table: "Videos");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_Videos",
|
||||
table: "Videos",
|
||||
column: "playlistItemId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_Videos",
|
||||
table: "Videos");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_Videos",
|
||||
table: "Videos",
|
||||
column: "videoId");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
// <auto-generated />
|
||||
|
||||
using FreeTubeSync.Database;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
|
|
@ -81,10 +80,10 @@ namespace FreeTubeSync.Migrations
|
|||
b.Property<string>("_id")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("createdAt")
|
||||
b.Property<long>("createdAt")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("lastUpdatedAt")
|
||||
b.Property<long>("lastUpdatedAt")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("playlistName")
|
||||
|
|
@ -96,7 +95,7 @@ namespace FreeTubeSync.Migrations
|
|||
|
||||
b.HasKey("_id");
|
||||
|
||||
b.ToTable("Playlists");
|
||||
b.ToTable("Playlists", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FreeTubeSync.Model.Profile", b =>
|
||||
|
|
@ -118,7 +117,7 @@ namespace FreeTubeSync.Migrations
|
|||
|
||||
b.HasKey("_id");
|
||||
|
||||
b.ToTable("Profiles");
|
||||
b.ToTable("Profiles", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FreeTubeSync.Model.SearchHistory", b =>
|
||||
|
|
@ -126,7 +125,7 @@ namespace FreeTubeSync.Migrations
|
|||
b.Property<string>("_id")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("lastUpdatedAt")
|
||||
b.Property<long>("lastUpdatedAt")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("_id");
|
||||
|
|
@ -173,7 +172,7 @@ namespace FreeTubeSync.Migrations
|
|||
|
||||
modelBuilder.Entity("FreeTubeSync.Model.Video", b =>
|
||||
{
|
||||
b.Property<string>("videoId")
|
||||
b.Property<string>("playlistItemId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Playlist_id")
|
||||
|
|
@ -191,14 +190,10 @@ namespace FreeTubeSync.Migrations
|
|||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("playlistItemId")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("pubished")
|
||||
b.Property<long>("pubished")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("timeAdded")
|
||||
b.Property<long>("timeAdded")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("title")
|
||||
|
|
@ -209,7 +204,11 @@ namespace FreeTubeSync.Migrations
|
|||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("videoId");
|
||||
b.Property<string>("videoId")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("playlistItemId");
|
||||
|
||||
b.HasIndex("Playlist_id");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue