[backend/database] Rename DataProtectionKeys table to data_protection_keys for consistency

This commit is contained in:
Laura Hausmann 2024-04-28 20:15:56 +02:00
parent 8c5358efd9
commit bee733b3da
No known key found for this signature in database
GPG key ID: D044E84C5BE01605
3 changed files with 50 additions and 1 deletions

View file

@ -1180,6 +1180,8 @@ public class DatabaseContext(DbContextOptions<DatabaseContext> options)
entity.HasOne<Worker>().WithMany().HasForeignKey(d => d.WorkerId).OnDelete(DeleteBehavior.SetNull);
});
modelBuilder.Entity<DataProtectionKey>().ToTable("data_protection_keys");
modelBuilder.ApplyConfigurationsFromAssembly(typeof(DatabaseContext).Assembly);
}

View file

@ -4859,7 +4859,7 @@ namespace Iceshrimp.Backend.Core.Database.Migrations
b.HasKey("Id");
b.ToTable("DataProtectionKeys");
b.ToTable("data_protection_keys", (string)null);
});
modelBuilder.Entity("Iceshrimp.Backend.Core.Database.Tables.AbuseUserReport", b =>

View file

@ -0,0 +1,47 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Infrastructure;
#nullable disable
namespace Iceshrimp.Backend.Core.Database.Migrations
{
/// <inheritdoc />
[DbContext(typeof(DatabaseContext))]
[Migration("20240428181455_RenameDataProtectionKeysTable")]
public partial class RenameDataProtectionKeysTable : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropPrimaryKey(
name: "PK_DataProtectionKeys",
table: "DataProtectionKeys");
migrationBuilder.RenameTable(
name: "DataProtectionKeys",
newName: "data_protection_keys");
migrationBuilder.AddPrimaryKey(
name: "PK_data_protection_keys",
table: "data_protection_keys",
column: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropPrimaryKey(
name: "PK_data_protection_keys",
table: "data_protection_keys");
migrationBuilder.RenameTable(
name: "data_protection_keys",
newName: "DataProtectionKeys");
migrationBuilder.AddPrimaryKey(
name: "PK_DataProtectionKeys",
table: "DataProtectionKeys",
column: "Id");
}
}
}