Skip to content

Commit

Permalink
Delete unused database columns (#822)
Browse files Browse the repository at this point in the history
* feat: remove unused BlobReference column from DatawalletModification

* feat: remove unused DeletedAt column from RelationshipTemplate

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
tnotheis and mergify[bot] authored Aug 30, 2024
1 parent 7b307dd commit c52f082
Show file tree
Hide file tree
Showing 24 changed files with 1,282 additions and 70 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public RelationshipTemplateDTO(RelationshipTemplate relationshipTemplate)
ExpiresAt = relationshipTemplate.ExpiresAt;
Content = relationshipTemplate.Content;
CreatedAt = relationshipTemplate.CreatedAt;
DeletedAt = relationshipTemplate.DeletedAt;
}

public string Id { get; set; }
Expand All @@ -23,5 +22,4 @@ public RelationshipTemplateDTO(RelationshipTemplate relationshipTemplate)
public DateTime? ExpiresAt { get; set; }
public byte[]? Content { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime? DeletedAt { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ public RelationshipTemplate(IdentityAddress createdBy, DeviceId createdByDevice,
public byte[]? Content { get; private set; }

public DateTime CreatedAt { get; set; }
public DateTime? DeletedAt { get; set; }

public List<RelationshipTemplateAllocation> Allocations { get; set; } = [];

Expand All @@ -61,14 +60,6 @@ public void AllocateFor(IdentityAddress identity, DeviceId device)
Allocations.Add(new RelationshipTemplateAllocation(Id, identity, device));
}

public void LoadContent(byte[] content)
{
if (Content != null)
throw new Exception("Cannot change the content of a relationship template.");

Content = content;
}

public static Expression<Func<RelationshipTemplate, bool>> WasCreatedBy(IdentityAddress identityAddress)
{
return r => r.CreatedBy == identityAddress.ToString();
Expand Down

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,31 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Backbone.Modules.Relationships.Infrastructure.Database.Postgres.Migrations
{
/// <inheritdoc />
public partial class RemoveDeletedAtPropertyFromRelationshipTemplate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "DeletedAt",
schema: "Relationships",
table: "RelationshipTemplates");
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<DateTime>(
name: "DeletedAt",
schema: "Relationships",
table: "RelationshipTemplates",
type: "timestamp with time zone",
nullable: true);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
#pragma warning disable 612, 618
modelBuilder
.HasDefaultSchema("Relationships")
.HasAnnotation("ProductVersion", "8.0.6")
.HasAnnotation("ProductVersion", "8.0.8")
.HasAnnotation("Relational:MaxIdentifierLength", 63);

NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
Expand Down Expand Up @@ -51,9 +51,6 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.HasColumnType("character(20)")
.IsFixedLength();

b.Property<DateTime?>("DeletedAt")
.HasColumnType("timestamp with time zone");

b.Property<DateTime?>("ExpiresAt")
.HasColumnType("timestamp with time zone");

Expand Down
Loading

0 comments on commit c52f082

Please sign in to comment.