Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ef migration & fix code format #40

Merged
merged 3 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

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
Loading