add create/update times to penalty identifiers

This commit is contained in:
RaidMax 2022-02-23 09:02:01 -06:00
parent a6b56ceded
commit 0d88b6293f
11 changed files with 5086 additions and 8 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,48 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Data.Migrations.MySql
{
public partial class AddAuditFieldsToEFPenaltyIdentifier : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Active",
table: "EFPenaltyIdentifiers");
migrationBuilder.AddColumn<DateTime>(
name: "CreatedDateTime",
table: "EFPenaltyIdentifiers",
type: "datetime(6)",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<DateTime>(
name: "UpdatedDateTime",
table: "EFPenaltyIdentifiers",
type: "datetime(6)",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "CreatedDateTime",
table: "EFPenaltyIdentifiers");
migrationBuilder.DropColumn(
name: "UpdatedDateTime",
table: "EFPenaltyIdentifiers");
migrationBuilder.AddColumn<bool>(
name: "Active",
table: "EFPenaltyIdentifiers",
type: "tinyint(1)",
nullable: false,
defaultValue: false);
}
}
}

View File

@ -974,8 +974,8 @@ namespace Data.Migrations.MySql
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<bool>("Active")
.HasColumnType("tinyint(1)");
b.Property<DateTime>("CreatedDateTime")
.HasColumnType("datetime(6)");
b.Property<int?>("IPv4Address")
.HasColumnType("int");
@ -986,6 +986,9 @@ namespace Data.Migrations.MySql
b.Property<int>("PenaltyId")
.HasColumnType("int");
b.Property<DateTime?>("UpdatedDateTime")
.HasColumnType("datetime(6)");
b.HasKey("PenaltyIdentifierId");
b.HasIndex("IPv4Address");

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,48 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Data.Migrations.Postgresql
{
public partial class AddAuditFieldsToEFPenaltyIdentifier : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Active",
table: "EFPenaltyIdentifiers");
migrationBuilder.AddColumn<DateTime>(
name: "CreatedDateTime",
table: "EFPenaltyIdentifiers",
type: "timestamp without time zone",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<DateTime>(
name: "UpdatedDateTime",
table: "EFPenaltyIdentifiers",
type: "timestamp without time zone",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "CreatedDateTime",
table: "EFPenaltyIdentifiers");
migrationBuilder.DropColumn(
name: "UpdatedDateTime",
table: "EFPenaltyIdentifiers");
migrationBuilder.AddColumn<bool>(
name: "Active",
table: "EFPenaltyIdentifiers",
type: "boolean",
nullable: false,
defaultValue: false);
}
}
}

View File

@ -1023,8 +1023,8 @@ namespace Data.Migrations.Postgresql
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("PenaltyIdentifierId"));
b.Property<bool>("Active")
.HasColumnType("boolean");
b.Property<DateTime>("CreatedDateTime")
.HasColumnType("timestamp without time zone");
b.Property<int?>("IPv4Address")
.HasColumnType("integer");
@ -1035,6 +1035,9 @@ namespace Data.Migrations.Postgresql
b.Property<int>("PenaltyId")
.HasColumnType("integer");
b.Property<DateTime?>("UpdatedDateTime")
.HasColumnType("timestamp without time zone");
b.HasKey("PenaltyIdentifierId");
b.HasIndex("IPv4Address");

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,48 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Data.Migrations.Sqlite
{
public partial class AddAuditFieldsToEFPenaltyIdentifier : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Active",
table: "EFPenaltyIdentifiers");
migrationBuilder.AddColumn<DateTime>(
name: "CreatedDateTime",
table: "EFPenaltyIdentifiers",
type: "TEXT",
nullable: false,
defaultValue: DateTime.UtcNow);
migrationBuilder.AddColumn<DateTime>(
name: "UpdatedDateTime",
table: "EFPenaltyIdentifiers",
type: "TEXT",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "CreatedDateTime",
table: "EFPenaltyIdentifiers");
migrationBuilder.DropColumn(
name: "UpdatedDateTime",
table: "EFPenaltyIdentifiers");
migrationBuilder.AddColumn<bool>(
name: "Active",
table: "EFPenaltyIdentifiers",
type: "INTEGER",
nullable: false,
defaultValue: false);
}
}
}

View File

@ -972,8 +972,8 @@ namespace Data.Migrations.Sqlite
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<bool>("Active")
.HasColumnType("INTEGER");
b.Property<DateTime>("CreatedDateTime")
.HasColumnType("TEXT");
b.Property<int?>("IPv4Address")
.HasColumnType("INTEGER");
@ -984,6 +984,9 @@ namespace Data.Migrations.Sqlite
b.Property<int>("PenaltyId")
.HasColumnType("INTEGER");
b.Property<DateTime?>("UpdatedDateTime")
.HasColumnType("TEXT");
b.HasKey("PenaltyIdentifierId");
b.HasIndex("IPv4Address");

View File

@ -10,4 +10,4 @@ namespace Stats.Models
public DateTime CreatedDateTime { get; set; } = DateTime.UtcNow;
public DateTime? UpdatedDateTime { get; set; }
}
}
}

View File

@ -1,9 +1,10 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Stats.Models;
namespace Data.Models;
public class EFPenaltyIdentifier : SharedEntity
public class EFPenaltyIdentifier : AuditFields
{
[Key]
public int PenaltyIdentifierId { get; set; }