Skip to content

Commit

Permalink
rename ObjectChange -> AuditLog
Browse files Browse the repository at this point in the history
  • Loading branch information
ascott18 committed Oct 23, 2023
1 parent 8c24974 commit 7361cc4
Show file tree
Hide file tree
Showing 52 changed files with 1,165 additions and 1,167 deletions.
8 changes: 4 additions & 4 deletions playground/Coalesce.Domain/AppDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Coalesce.Domain
{

[Coalesce]
public class AppDbContext : DbContext, IAuditLogContext<ObjectChange>
public class AppDbContext : DbContext, IAuditLogContext<AuditLog>
{
#nullable disable
public DbSet<Person> People { get; set; }
Expand All @@ -22,8 +22,8 @@ public class AppDbContext : DbContext, IAuditLogContext<ObjectChange>
public DbSet<ZipCode> ZipCodes { get; set; }
public DbSet<Log> Logs { get; set; }

public DbSet<ObjectChange> ObjectChanges { get; set; }
public DbSet<ObjectChangeProperty> ObjectChangeProperties { get; set; }
public DbSet<AuditLog> AuditLogs { get; set; }
public DbSet<AuditLogProperty> AuditLogProperties { get; set; }

#nullable restore

Expand All @@ -38,7 +38,7 @@ public AppDbContext(DbContextOptions options) : base(options)
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder
.UseCoalesceAuditLogging<ObjectChange>(x => x
.UseCoalesceAuditLogging<AuditLog>(x => x
.WithAugmentation<OperationContext>()
.WithMergeWindow(TimeSpan.FromSeconds(15))
.ConfigureAudit(x => x
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
Expand Up @@ -30,7 +30,7 @@ protected override void Up(MigrationBuilder migrationBuilder)
oldNullable: true);

migrationBuilder.CreateTable(
name: "ObjectChanges",
name: "AuditLogs",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false)
Expand All @@ -47,16 +47,16 @@ protected override void Up(MigrationBuilder migrationBuilder)
},
constraints: table =>
{
table.PrimaryKey("PK_ObjectChanges", x => x.Id);
table.PrimaryKey("PK_AuditLogs", x => x.Id);
table.ForeignKey(
name: "FK_ObjectChanges_Person_UserId",
name: "FK_AuditLogs_Person_UserId",
column: x => x.UserId,
principalTable: "Person",
principalColumn: "PersonId");
});

migrationBuilder.CreateTable(
name: "ObjectChangeProperties",
name: "AuditLogProperties",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false)
Expand All @@ -68,48 +68,48 @@ protected override void Up(MigrationBuilder migrationBuilder)
},
constraints: table =>
{
table.PrimaryKey("PK_ObjectChangeProperties", x => x.Id);
table.PrimaryKey("PK_AuditLogProperties", x => x.Id);
table.ForeignKey(
name: "FK_ObjectChangeProperties_ObjectChanges_ParentId",
name: "FK_AuditLogProperties_AuditLogs_ParentId",
column: x => x.ParentId,
principalTable: "ObjectChanges",
principalTable: "AuditLogs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});

migrationBuilder.CreateIndex(
name: "IX_ObjectChangeProperties_ParentId",
table: "ObjectChangeProperties",
name: "IX_AuditLogProperties_ParentId",
table: "AuditLogProperties",
column: "ParentId");

migrationBuilder.CreateIndex(
name: "IX_ObjectChanges_State",
table: "ObjectChanges",
name: "IX_AuditLogs_State",
table: "AuditLogs",
column: "State");

migrationBuilder.CreateIndex(
name: "IX_ObjectChanges_Type",
table: "ObjectChanges",
name: "IX_AuditLogs_Type",
table: "AuditLogs",
column: "Type");

migrationBuilder.CreateIndex(
name: "IX_ObjectChanges_Type_KeyValue",
table: "ObjectChanges",
name: "IX_AuditLogs_Type_KeyValue",
table: "AuditLogs",
columns: new[] { "Type", "KeyValue" });

migrationBuilder.CreateIndex(
name: "IX_ObjectChanges_UserId",
table: "ObjectChanges",
name: "IX_AuditLogs_UserId",
table: "AuditLogs",
column: "UserId");
}

protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ObjectChangeProperties");
name: "AuditLogProperties");

migrationBuilder.DropTable(
name: "ObjectChanges");
name: "AuditLogs");

migrationBuilder.AlterColumn<string>(
name: "State",
Expand Down
Loading

0 comments on commit 7361cc4

Please sign in to comment.