Add Archive model and update context for archive statistics

This commit is contained in:
2025-09-28 02:02:55 +01:00
parent b46d2acc7f
commit c137fef65d
5 changed files with 3034 additions and 1 deletions

View File

@@ -46,6 +46,9 @@ public sealed class AaruContext : DbContext
/// <param name="options">Options</param>
public AaruContext(DbContextOptions options) : base(options) {}
/// <summary>Statistics for archives</summary>
public DbSet<Archive> Archives { get; set; }
/// <summary>List of known devices</summary>
public DbSet<Device> Devices { get; set; }

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,36 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Aaru.Database.Migrations
{
/// <inheritdoc />
public partial class AddArchiveToStat : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Archives",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Name = table.Column<string>(type: "TEXT", nullable: true),
Synchronized = table.Column<bool>(type: "INTEGER", nullable: false),
Count = table.Column<ulong>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Archives", x => x.Id);
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Archives");
}
}
}

View File

@@ -16,7 +16,7 @@ namespace Aaru.Database.Migrations
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.0")
.HasAnnotation("ProductVersion", "10.0.0-preview.7.25380.108")
.HasAnnotation("Proxies:ChangeTracking", false)
.HasAnnotation("Proxies:CheckEquality", false)
.HasAnnotation("Proxies:LazyLoading", true);
@@ -2010,6 +2010,26 @@ namespace Aaru.Database.Migrations
b.ToTable("Usb");
});
modelBuilder.Entity("Aaru.Database.Models.Archive", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<ulong>("Count")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.HasColumnType("TEXT");
b.Property<bool>("Synchronized")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.ToTable("Archives");
});
modelBuilder.Entity("Aaru.Database.Models.CdOffset", b =>
{
b.Property<int>("Id")

View File

@@ -0,0 +1,37 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : MediaFormat.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Database.
//
// --[ Description ] ----------------------------------------------------------
//
// Model for storing archive statistics in database.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2025 Natalia Portillo
// ****************************************************************************/
namespace Aaru.Database.Models;
/// <inheritdoc />
/// <summary>Media image format</summary>
public class Archive : NameCountModel;