mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 11:14:27 +00:00
Add Archive model and migration for storing archive statistics
This commit is contained in:
1
.idea/.idea.Aaru.Server/.idea/vcs.xml
generated
1
.idea/.idea.Aaru.Server/.idea/vcs.xml
generated
@@ -7,7 +7,6 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="VcsDirectoryMappings">
|
<component name="VcsDirectoryMappings">
|
||||||
<mapping directory="" vcs="Git" />
|
<mapping directory="" vcs="Git" />
|
||||||
<mapping directory="$PROJECT_DIR$/Aaru.Server.Old/wwwroot" vcs="Git" />
|
|
||||||
<mapping directory="$PROJECT_DIR$/Aaru.Server/Aaru.Documentation" vcs="Git" />
|
<mapping directory="$PROJECT_DIR$/Aaru.Server/Aaru.Documentation" vcs="Git" />
|
||||||
<mapping directory="$PROJECT_DIR$/Aaru.Server/wwwroot" vcs="Git" />
|
<mapping directory="$PROJECT_DIR$/Aaru.Server/wwwroot" vcs="Git" />
|
||||||
<mapping directory="$PROJECT_DIR$/CICMMetadata" vcs="Git" />
|
<mapping directory="$PROJECT_DIR$/CICMMetadata" vcs="Git" />
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ public sealed class DbContext : IdentityDbContext<IdentityUser>
|
|||||||
|
|
||||||
public DbContext(DbContextOptions<DbContext> options) : base(options) {}
|
public DbContext(DbContextOptions<DbContext> options) : base(options) {}
|
||||||
|
|
||||||
|
public DbSet<Archive> Archives { get; set; }
|
||||||
public DbSet<Device> Devices { get; set; }
|
public DbSet<Device> Devices { get; set; }
|
||||||
public DbSet<UploadedReport> Reports { get; set; }
|
public DbSet<UploadedReport> Reports { get; set; }
|
||||||
public DbSet<Command> Commands { get; set; }
|
public DbSet<Command> Commands { get; set; }
|
||||||
|
|||||||
3281
Aaru.Server.Database/Migrations/20250928003741_AddArchiveToStats.Designer.cs
generated
Normal file
3281
Aaru.Server.Database/Migrations/20250928003741_AddArchiveToStats.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,38 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Aaru.Server.Database.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class AddArchiveToStats : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Archives",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||||
|
Name = table.Column<string>(type: "longtext", nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
Count = table.Column<long>(type: "bigint", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Archives", x => x.Id);
|
||||||
|
})
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Archives");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,7 +17,7 @@ namespace Aaru.Server.Database.Migrations
|
|||||||
{
|
{
|
||||||
#pragma warning disable 612, 618
|
#pragma warning disable 612, 618
|
||||||
modelBuilder
|
modelBuilder
|
||||||
.HasAnnotation("ProductVersion", "9.0.0")
|
.HasAnnotation("ProductVersion", "9.0.9")
|
||||||
.HasAnnotation("Proxies:ChangeTracking", false)
|
.HasAnnotation("Proxies:ChangeTracking", false)
|
||||||
.HasAnnotation("Proxies:CheckEquality", false)
|
.HasAnnotation("Proxies:CheckEquality", false)
|
||||||
.HasAnnotation("Proxies:LazyLoading", true)
|
.HasAnnotation("Proxies:LazyLoading", true)
|
||||||
@@ -2052,6 +2052,26 @@ namespace Aaru.Server.Database.Migrations
|
|||||||
b.ToTable("Usb");
|
b.ToTable("Usb");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Aaru.Server.Database.Models.Archive", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<long>("Count")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Archives");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Aaru.Server.Database.Models.Command", b =>
|
modelBuilder.Entity("Aaru.Server.Database.Models.Command", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
|
|||||||
35
Aaru.Server.Database/Models/Archive.cs
Normal file
35
Aaru.Server.Database/Models/Archive.cs
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
// /***************************************************************************
|
||||||
|
// Aaru Data Preservation Suite
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Filename : Archive.cs
|
||||||
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||||
|
//
|
||||||
|
// Component : Aaru Server.
|
||||||
|
//
|
||||||
|
// --[ 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-2024 Natalia Portillo
|
||||||
|
// ****************************************************************************/
|
||||||
|
|
||||||
|
namespace Aaru.Server.Database.Models;
|
||||||
|
|
||||||
|
public class Archive : NameCountModel<int> {}
|
||||||
Reference in New Issue
Block a user