Skip to content

Commit

Permalink
Add ef migration & fix code format (#40)
Browse files Browse the repository at this point in the history
* bugfix and upgrade to v2.0.2.0.

* Add ef migration & code format
  • Loading branch information
nodew authored Nov 1, 2024
1 parent 3f6baf4 commit f734851
Show file tree
Hide file tree
Showing 5 changed files with 250 additions and 17 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace PocketClient.Core.Data.Migrations
{
/// <inheritdoc />
public partial class OptionalAuthorUrl : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "Url",
table: "Authors",
type: "TEXT",
nullable: true,
oldClrType: typeof(string),
oldType: "TEXT");
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "Url",
table: "Authors",
type: "TEXT",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "TEXT",
oldNullable: true);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ partial class PocketDbContextModelSnapshot : ModelSnapshot
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "7.0.0");
modelBuilder.HasAnnotation("ProductVersion", "8.0.10");

modelBuilder.Entity("PocketClient.Core.Models.Author", b =>
{
Expand All @@ -28,7 +28,6 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.HasColumnType("TEXT");

b.Property<string>("Url")
.IsRequired()
.HasColumnType("TEXT");

b.HasKey("Id");
Expand Down
15 changes: 1 addition & 14 deletions PocketClient.Desktop/Services/PocketDbService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,20 +125,7 @@ public async Task SyncItemsAsync(bool fullSync = false, bool force = false)
Since = lastUpdatedAt,
};

List<PocketItem> items;

try
{
items = await _pocketClient.GetItemsAsync(filter, pageSize, page * pageSize);
}
catch (Exception ex)
{
_syncing = false;
_logger.LogError(ex, "Failed to get items from server");
WeakReferenceMessenger.Default.Send(new SyncFailureMessage("Failed to get items from server", ex));
return;
}

var items = await _pocketClient.GetItemsAsync(filter, pageSize, page * pageSize);
hasMoreItems = items.Count == pageSize;
count += items.Count;
page++;
Expand Down
2 changes: 1 addition & 1 deletion PocketClient.Desktop/ViewModels/ItemsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.Mvvm.Messaging;
using Microsoft.UI.Dispatching;
using PocketClient.Core.Contracts.Services;
using PocketClient.Core.Models;
using PocketClient.Core.Specifications;
using PocketClient.Desktop.Contracts.ViewModels;
using PocketClient.Desktop.Helpers;
using PocketClient.Desktop.Models;
using Microsoft.UI.Dispatching;

namespace PocketClient.Desktop.ViewModels;

Expand Down

0 comments on commit f734851

Please sign in to comment.