fix up timestamp issues with ef code-first

This commit is contained in:
Collin M. Barrett 2018-08-15 12:53:05 -05:00
parent 55d057c8cd
commit 6ced620dc7
11 changed files with 1217 additions and 93 deletions

View file

@ -0,0 +1,592 @@
// <auto-generated />
using System;
using FilterLists.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
namespace FilterLists.Api.Migrations
{
[DbContext(typeof(FilterListsDbContext))]
[Migration("20180815174531_fixTimestampNullsAndDefaults")]
partial class fixTimestampNullsAndDefaults
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.1.1-rtm-30846")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("FilterLists.Data.Entities.FilterList", b =>
{
b.Property<ushort>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("SMALLINT UNSIGNED")
.HasAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
b.Property<string>("ChatUrl")
.HasColumnType("TEXT");
b.Property<DateTime?>("CreatedDateUtc")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("current_timestamp()");
b.Property<string>("Description")
.HasColumnType("TEXT");
b.Property<string>("DescriptionSourceUrl")
.HasColumnType("TEXT");
b.Property<DateTime?>("DiscontinuedDate")
.ValueGeneratedOnAdd()
.HasColumnType("DATE")
.HasDefaultValueSql("NULL");
b.Property<string>("DonateUrl")
.HasColumnType("TEXT");
b.Property<string>("EmailAddress")
.ValueGeneratedOnAdd()
.HasColumnType("VARCHAR(126)")
.HasDefaultValueSql("NULL");
b.Property<string>("ForumUrl")
.HasColumnType("TEXT");
b.Property<string>("HomeUrl")
.HasColumnType("TEXT");
b.Property<string>("IssuesUrl")
.HasColumnType("TEXT");
b.Property<byte>("LicenseId")
.ValueGeneratedOnAdd()
.HasDefaultValue((byte)5);
b.Property<DateTime?>("ModifiedDateUtc")
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("current_timestamp() ON UPDATE current_timestamp()");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("VARCHAR(126)");
b.Property<string>("PolicyUrl")
.HasColumnType("TEXT");
b.Property<DateTime?>("PublishedDate")
.ValueGeneratedOnAdd()
.HasColumnType("DATE")
.HasDefaultValueSql("NULL");
b.Property<string>("SubmissionUrl")
.HasColumnType("TEXT");
b.Property<byte?>("SyntaxId");
b.Property<string>("ViewUrl")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("LicenseId");
b.HasIndex("SyntaxId");
b.ToTable("filterlists");
});
modelBuilder.Entity("FilterLists.Data.Entities.Junctions.FilterListLanguage", b =>
{
b.Property<ushort>("FilterListId");
b.Property<ushort>("LanguageId");
b.Property<DateTime?>("CreatedDateUtc")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("current_timestamp()");
b.HasKey("FilterListId", "LanguageId");
b.HasIndex("LanguageId");
b.ToTable("filterlists_languages");
});
modelBuilder.Entity("FilterLists.Data.Entities.Junctions.FilterListMaintainer", b =>
{
b.Property<ushort>("FilterListId");
b.Property<ushort>("MaintainerId");
b.Property<DateTime?>("CreatedDateUtc")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("current_timestamp()");
b.HasKey("FilterListId", "MaintainerId");
b.HasIndex("MaintainerId");
b.ToTable("filterlists_maintainers");
});
modelBuilder.Entity("FilterLists.Data.Entities.Junctions.Fork", b =>
{
b.Property<ushort>("ForkFilterListId");
b.Property<ushort>("UpstreamFilterListId");
b.Property<DateTime?>("CreatedDateUtc")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("current_timestamp()");
b.HasKey("ForkFilterListId", "UpstreamFilterListId");
b.HasIndex("UpstreamFilterListId");
b.ToTable("forks");
});
modelBuilder.Entity("FilterLists.Data.Entities.Junctions.Merge", b =>
{
b.Property<ushort>("MergeFilterListId");
b.Property<ushort>("UpstreamFilterListId");
b.Property<DateTime?>("CreatedDateUtc")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("current_timestamp()");
b.HasKey("MergeFilterListId", "UpstreamFilterListId");
b.HasIndex("UpstreamFilterListId");
b.ToTable("merges");
});
modelBuilder.Entity("FilterLists.Data.Entities.Junctions.SnapshotRule", b =>
{
b.Property<uint>("AddedBySnapshotId");
b.Property<uint>("RuleId");
b.Property<DateTime?>("CreatedDateUtc")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("current_timestamp()");
b.Property<DateTime?>("ModifiedDateUtc")
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("current_timestamp() ON UPDATE current_timestamp()");
b.Property<uint?>("RemovedBySnapshotId");
b.HasKey("AddedBySnapshotId", "RuleId");
b.HasIndex("RemovedBySnapshotId");
b.HasIndex("RuleId");
b.ToTable("snapshots_rules");
});
modelBuilder.Entity("FilterLists.Data.Entities.Junctions.SoftwareSyntax", b =>
{
b.Property<byte>("SyntaxId");
b.Property<byte>("SoftwareId");
b.Property<DateTime?>("CreatedDateUtc")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("current_timestamp()");
b.HasKey("SyntaxId", "SoftwareId");
b.HasIndex("SoftwareId");
b.ToTable("software_syntaxes");
});
modelBuilder.Entity("FilterLists.Data.Entities.Language", b =>
{
b.Property<ushort>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("SMALLINT UNSIGNED")
.HasAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
b.Property<DateTime?>("CreatedDateUtc")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("current_timestamp()");
b.Property<string>("Iso6391")
.ValueGeneratedOnAdd()
.HasColumnType("VARCHAR(2)")
.HasDefaultValueSql("NULL");
b.Property<string>("Iso6392")
.ValueGeneratedOnAdd()
.HasColumnType("VARCHAR(3)")
.HasDefaultValueSql("NULL");
b.Property<string>("Iso6392B")
.ValueGeneratedOnAdd()
.HasColumnType("VARCHAR(3)")
.HasDefaultValueSql("NULL");
b.Property<string>("Iso6392T")
.ValueGeneratedOnAdd()
.HasColumnType("VARCHAR(3)")
.HasDefaultValueSql("NULL");
b.Property<string>("Iso6393")
.ValueGeneratedOnAdd()
.HasColumnType("VARCHAR(3)")
.HasDefaultValueSql("NULL");
b.Property<string>("LocalName")
.ValueGeneratedOnAdd()
.HasColumnType("VARCHAR(126)")
.HasDefaultValueSql("NULL");
b.Property<DateTime?>("ModifiedDateUtc")
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("current_timestamp() ON UPDATE current_timestamp()");
b.Property<string>("Name")
.ValueGeneratedOnAdd()
.HasColumnType("VARCHAR(126)")
.HasDefaultValueSql("NULL");
b.HasKey("Id");
b.ToTable("languages");
});
modelBuilder.Entity("FilterLists.Data.Entities.License", b =>
{
b.Property<byte>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TINYINT UNSIGNED")
.HasAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
b.Property<DateTime?>("CreatedDateUtc")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("current_timestamp()");
b.Property<string>("DescriptionUrl")
.HasColumnType("TEXT");
b.Property<DateTime?>("ModifiedDateUtc")
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("current_timestamp() ON UPDATE current_timestamp()");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("VARCHAR(126)");
b.Property<bool>("PermissiveAdaptation");
b.Property<bool>("PermissiveCommercial");
b.HasKey("Id");
b.ToTable("licenses");
});
modelBuilder.Entity("FilterLists.Data.Entities.Maintainer", b =>
{
b.Property<ushort>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("SMALLINT UNSIGNED")
.HasAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
b.Property<DateTime?>("CreatedDateUtc")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("current_timestamp()");
b.Property<string>("EmailAddress")
.ValueGeneratedOnAdd()
.HasColumnType("VARCHAR(126)")
.HasDefaultValueSql("NULL");
b.Property<string>("HomeUrl")
.HasColumnType("TEXT");
b.Property<DateTime?>("ModifiedDateUtc")
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("current_timestamp() ON UPDATE current_timestamp()");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("VARCHAR(126)");
b.Property<string>("TwitterHandle")
.ValueGeneratedOnAdd()
.HasColumnType("VARCHAR(126)")
.HasDefaultValueSql("NULL");
b.HasKey("Id");
b.ToTable("maintainers");
});
modelBuilder.Entity("FilterLists.Data.Entities.Rule", b =>
{
b.Property<uint>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INT UNSIGNED")
.HasAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
b.Property<DateTime?>("CreatedDateUtc")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("current_timestamp()");
b.Property<string>("Raw")
.IsRequired()
.HasColumnType("VARCHAR(8192)");
b.HasKey("Id");
b.ToTable("rules");
});
modelBuilder.Entity("FilterLists.Data.Entities.Snapshot", b =>
{
b.Property<uint>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("MEDIUMINT UNSIGNED")
.HasAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
b.Property<DateTime?>("CreatedDateUtc")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("current_timestamp()");
b.Property<ushort>("FilterListId");
b.Property<string>("HttpStatusCode")
.ValueGeneratedOnAdd()
.HasColumnType("VARCHAR(3)")
.HasDefaultValueSql("NULL");
b.Property<bool>("IsCompleted");
b.Property<DateTime?>("ModifiedDateUtc")
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("current_timestamp() ON UPDATE current_timestamp()");
b.HasKey("Id");
b.HasIndex("FilterListId");
b.ToTable("snapshots");
});
modelBuilder.Entity("FilterLists.Data.Entities.Software", b =>
{
b.Property<byte>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TINYINT UNSIGNED")
.HasAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
b.Property<DateTime?>("CreatedDateUtc")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("current_timestamp()");
b.Property<string>("DownloadUrl")
.HasColumnType("TEXT");
b.Property<string>("HomeUrl")
.HasColumnType("TEXT");
b.Property<DateTime?>("ModifiedDateUtc")
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("current_timestamp() ON UPDATE current_timestamp()");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("VARCHAR(126)");
b.HasKey("Id");
b.ToTable("software");
});
modelBuilder.Entity("FilterLists.Data.Entities.Syntax", b =>
{
b.Property<byte>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TINYINT UNSIGNED")
.HasAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
b.Property<DateTime?>("CreatedDateUtc")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("current_timestamp()");
b.Property<string>("DefinitionUrl")
.HasColumnType("TEXT");
b.Property<DateTime?>("ModifiedDateUtc")
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("current_timestamp() ON UPDATE current_timestamp()");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("VARCHAR(126)");
b.HasKey("Id");
b.ToTable("syntaxes");
});
modelBuilder.Entity("FilterLists.Data.Entities.FilterList", b =>
{
b.HasOne("FilterLists.Data.Entities.License", "License")
.WithMany("FilterLists")
.HasForeignKey("LicenseId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("FilterLists.Data.Entities.Syntax", "Syntax")
.WithMany("FilterLists")
.HasForeignKey("SyntaxId");
});
modelBuilder.Entity("FilterLists.Data.Entities.Junctions.FilterListLanguage", b =>
{
b.HasOne("FilterLists.Data.Entities.FilterList", "FilterList")
.WithMany("FilterListLanguages")
.HasForeignKey("FilterListId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("FilterLists.Data.Entities.Language", "Language")
.WithMany("FilterListLanguages")
.HasForeignKey("LanguageId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("FilterLists.Data.Entities.Junctions.FilterListMaintainer", b =>
{
b.HasOne("FilterLists.Data.Entities.FilterList", "FilterList")
.WithMany("FilterListMaintainers")
.HasForeignKey("FilterListId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("FilterLists.Data.Entities.Maintainer", "Maintainer")
.WithMany("FilterListMaintainers")
.HasForeignKey("MaintainerId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("FilterLists.Data.Entities.Junctions.Fork", b =>
{
b.HasOne("FilterLists.Data.Entities.FilterList", "ForkFilterList")
.WithMany("ForkFilterLists")
.HasForeignKey("ForkFilterListId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("FilterLists.Data.Entities.FilterList", "UpstreamFilterList")
.WithMany("UpstreamForkFilterLists")
.HasForeignKey("UpstreamFilterListId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("FilterLists.Data.Entities.Junctions.Merge", b =>
{
b.HasOne("FilterLists.Data.Entities.FilterList", "MergeFilterList")
.WithMany("MergeFilterLists")
.HasForeignKey("MergeFilterListId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("FilterLists.Data.Entities.FilterList", "UpstreamFilterList")
.WithMany("UpstreamMergeFilterLists")
.HasForeignKey("UpstreamFilterListId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("FilterLists.Data.Entities.Junctions.SnapshotRule", b =>
{
b.HasOne("FilterLists.Data.Entities.Snapshot", "AddedBySnapshot")
.WithMany("AddedSnapshotRules")
.HasForeignKey("AddedBySnapshotId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("FilterLists.Data.Entities.Snapshot", "RemovedBySnapshot")
.WithMany("RemovedSnapshotRules")
.HasForeignKey("RemovedBySnapshotId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("FilterLists.Data.Entities.Rule", "Rule")
.WithMany("SnapshotRules")
.HasForeignKey("RuleId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("FilterLists.Data.Entities.Junctions.SoftwareSyntax", b =>
{
b.HasOne("FilterLists.Data.Entities.Software", "Software")
.WithMany("SoftwareSyntaxes")
.HasForeignKey("SoftwareId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("FilterLists.Data.Entities.Syntax", "Syntax")
.WithMany("SoftwareSyntaxes")
.HasForeignKey("SyntaxId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("FilterLists.Data.Entities.Snapshot", b =>
{
b.HasOne("FilterLists.Data.Entities.FilterList", "FilterList")
.WithMany("Snapshots")
.HasForeignKey("FilterListId")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
}
}

View file

@ -0,0 +1,476 @@
using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
namespace FilterLists.Api.Migrations
{
public partial class fixTimestampNullsAndDefaults : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<DateTime>(
"ModifiedDateUtc",
"syntaxes",
"TIMESTAMP",
nullable: false,
defaultValueSql: "current_timestamp() ON UPDATE current_timestamp()",
oldClrType: typeof(DateTime),
oldType: "TIMESTAMP")
.OldAnnotation("MySql:ValueGenerationStrategy",
MySqlValueGenerationStrategy.ComputedColumn);
migrationBuilder.AlterColumn<DateTime>(
"CreatedDateUtc",
"syntaxes",
"TIMESTAMP",
nullable: false,
defaultValueSql: "current_timestamp()",
oldClrType: typeof(DateTime),
oldType: "TIMESTAMP")
.OldAnnotation("MySql:ValueGenerationStrategy",
MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<DateTime>(
"CreatedDateUtc",
"software_syntaxes",
"TIMESTAMP",
nullable: false,
defaultValueSql: "current_timestamp()",
oldClrType: typeof(DateTime),
oldType: "TIMESTAMP")
.OldAnnotation("MySql:ValueGenerationStrategy",
MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<DateTime>(
"ModifiedDateUtc",
"software",
"TIMESTAMP",
nullable: false,
defaultValueSql: "current_timestamp() ON UPDATE current_timestamp()",
oldClrType: typeof(DateTime),
oldType: "TIMESTAMP")
.OldAnnotation("MySql:ValueGenerationStrategy",
MySqlValueGenerationStrategy.ComputedColumn);
migrationBuilder.AlterColumn<DateTime>(
"CreatedDateUtc",
"software",
"TIMESTAMP",
nullable: false,
defaultValueSql: "current_timestamp()",
oldClrType: typeof(DateTime),
oldType: "TIMESTAMP")
.OldAnnotation("MySql:ValueGenerationStrategy",
MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<DateTime>(
"ModifiedDateUtc",
"snapshots_rules",
"TIMESTAMP",
nullable: false,
defaultValueSql: "current_timestamp() ON UPDATE current_timestamp()",
oldClrType: typeof(DateTime),
oldType: "TIMESTAMP")
.OldAnnotation("MySql:ValueGenerationStrategy",
MySqlValueGenerationStrategy.ComputedColumn);
migrationBuilder.AlterColumn<DateTime>(
"CreatedDateUtc",
"snapshots_rules",
"TIMESTAMP",
nullable: false,
defaultValueSql: "current_timestamp()",
oldClrType: typeof(DateTime),
oldType: "TIMESTAMP")
.OldAnnotation("MySql:ValueGenerationStrategy",
MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<DateTime>(
"ModifiedDateUtc",
"snapshots",
"TIMESTAMP",
nullable: false,
defaultValueSql: "current_timestamp() ON UPDATE current_timestamp()",
oldClrType: typeof(DateTime),
oldType: "TIMESTAMP",
oldDefaultValueSql: "CURRENT_TIMESTAMP()");
migrationBuilder.AlterColumn<DateTime>(
"CreatedDateUtc",
"snapshots",
"TIMESTAMP",
nullable: false,
defaultValueSql: "current_timestamp()",
oldClrType: typeof(DateTime),
oldType: "TIMESTAMP")
.OldAnnotation("MySql:ValueGenerationStrategy",
MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<DateTime>(
"CreatedDateUtc",
"rules",
"TIMESTAMP",
nullable: false,
defaultValueSql: "current_timestamp()",
oldClrType: typeof(DateTime),
oldType: "TIMESTAMP")
.OldAnnotation("MySql:ValueGenerationStrategy",
MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<DateTime>(
"CreatedDateUtc",
"merges",
"TIMESTAMP",
nullable: false,
defaultValueSql: "current_timestamp()",
oldClrType: typeof(DateTime),
oldType: "TIMESTAMP")
.OldAnnotation("MySql:ValueGenerationStrategy",
MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<DateTime>(
"ModifiedDateUtc",
"maintainers",
"TIMESTAMP",
nullable: false,
defaultValueSql: "current_timestamp() ON UPDATE current_timestamp()",
oldClrType: typeof(DateTime),
oldType: "TIMESTAMP")
.OldAnnotation("MySql:ValueGenerationStrategy",
MySqlValueGenerationStrategy.ComputedColumn);
migrationBuilder.AlterColumn<DateTime>(
"CreatedDateUtc",
"maintainers",
"TIMESTAMP",
nullable: false,
defaultValueSql: "current_timestamp()",
oldClrType: typeof(DateTime),
oldType: "TIMESTAMP")
.OldAnnotation("MySql:ValueGenerationStrategy",
MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<DateTime>(
"ModifiedDateUtc",
"licenses",
"TIMESTAMP",
nullable: false,
defaultValueSql: "current_timestamp() ON UPDATE current_timestamp()",
oldClrType: typeof(DateTime),
oldType: "TIMESTAMP")
.OldAnnotation("MySql:ValueGenerationStrategy",
MySqlValueGenerationStrategy.ComputedColumn);
migrationBuilder.AlterColumn<DateTime>(
"CreatedDateUtc",
"licenses",
"TIMESTAMP",
nullable: false,
defaultValueSql: "current_timestamp()",
oldClrType: typeof(DateTime),
oldType: "TIMESTAMP")
.OldAnnotation("MySql:ValueGenerationStrategy",
MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<DateTime>(
"ModifiedDateUtc",
"languages",
"TIMESTAMP",
nullable: false,
defaultValueSql: "current_timestamp() ON UPDATE current_timestamp()",
oldClrType: typeof(DateTime),
oldType: "TIMESTAMP")
.OldAnnotation("MySql:ValueGenerationStrategy",
MySqlValueGenerationStrategy.ComputedColumn);
migrationBuilder.AlterColumn<DateTime>(
"CreatedDateUtc",
"languages",
"TIMESTAMP",
nullable: false,
defaultValueSql: "current_timestamp()",
oldClrType: typeof(DateTime),
oldType: "TIMESTAMP")
.OldAnnotation("MySql:ValueGenerationStrategy",
MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<DateTime>(
"CreatedDateUtc",
"forks",
"TIMESTAMP",
nullable: false,
defaultValueSql: "current_timestamp()",
oldClrType: typeof(DateTime),
oldType: "TIMESTAMP")
.OldAnnotation("MySql:ValueGenerationStrategy",
MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<DateTime>(
"CreatedDateUtc",
"filterlists_maintainers",
"TIMESTAMP",
nullable: false,
defaultValueSql: "current_timestamp()",
oldClrType: typeof(DateTime),
oldType: "TIMESTAMP")
.OldAnnotation("MySql:ValueGenerationStrategy",
MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<DateTime>(
"CreatedDateUtc",
"filterlists_languages",
"TIMESTAMP",
nullable: false,
defaultValueSql: "current_timestamp()",
oldClrType: typeof(DateTime),
oldType: "TIMESTAMP")
.OldAnnotation("MySql:ValueGenerationStrategy",
MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<DateTime>(
"ModifiedDateUtc",
"filterlists",
"TIMESTAMP",
nullable: false,
defaultValueSql: "current_timestamp() ON UPDATE current_timestamp()",
oldClrType: typeof(DateTime),
oldType: "TIMESTAMP")
.OldAnnotation("MySql:ValueGenerationStrategy",
MySqlValueGenerationStrategy.ComputedColumn);
migrationBuilder.AlterColumn<DateTime>(
"CreatedDateUtc",
"filterlists",
"TIMESTAMP",
nullable: false,
defaultValueSql: "current_timestamp()",
oldClrType: typeof(DateTime),
oldType: "TIMESTAMP")
.OldAnnotation("MySql:ValueGenerationStrategy",
MySqlValueGenerationStrategy.IdentityColumn);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<DateTime>(
"ModifiedDateUtc",
"syntaxes",
"TIMESTAMP",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "TIMESTAMP",
oldDefaultValueSql: "current_timestamp() ON UPDATE current_timestamp()")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn);
migrationBuilder.AlterColumn<DateTime>(
"CreatedDateUtc",
"syntaxes",
"TIMESTAMP",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "TIMESTAMP",
oldDefaultValueSql: "current_timestamp()")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<DateTime>(
"CreatedDateUtc",
"software_syntaxes",
"TIMESTAMP",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "TIMESTAMP",
oldDefaultValueSql: "current_timestamp()")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<DateTime>(
"ModifiedDateUtc",
"software",
"TIMESTAMP",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "TIMESTAMP",
oldDefaultValueSql: "current_timestamp() ON UPDATE current_timestamp()")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn);
migrationBuilder.AlterColumn<DateTime>(
"CreatedDateUtc",
"software",
"TIMESTAMP",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "TIMESTAMP",
oldDefaultValueSql: "current_timestamp()")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<DateTime>(
"ModifiedDateUtc",
"snapshots_rules",
"TIMESTAMP",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "TIMESTAMP",
oldDefaultValueSql: "current_timestamp() ON UPDATE current_timestamp()")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn);
migrationBuilder.AlterColumn<DateTime>(
"CreatedDateUtc",
"snapshots_rules",
"TIMESTAMP",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "TIMESTAMP",
oldDefaultValueSql: "current_timestamp()")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<DateTime>(
"ModifiedDateUtc",
"snapshots",
"TIMESTAMP",
nullable: false,
defaultValueSql: "CURRENT_TIMESTAMP()",
oldClrType: typeof(DateTime),
oldType: "TIMESTAMP",
oldDefaultValueSql: "current_timestamp() ON UPDATE current_timestamp()");
migrationBuilder.AlterColumn<DateTime>(
"CreatedDateUtc",
"snapshots",
"TIMESTAMP",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "TIMESTAMP",
oldDefaultValueSql: "current_timestamp()")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<DateTime>(
"CreatedDateUtc",
"rules",
"TIMESTAMP",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "TIMESTAMP",
oldDefaultValueSql: "current_timestamp()")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<DateTime>(
"CreatedDateUtc",
"merges",
"TIMESTAMP",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "TIMESTAMP",
oldDefaultValueSql: "current_timestamp()")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<DateTime>(
"ModifiedDateUtc",
"maintainers",
"TIMESTAMP",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "TIMESTAMP",
oldDefaultValueSql: "current_timestamp() ON UPDATE current_timestamp()")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn);
migrationBuilder.AlterColumn<DateTime>(
"CreatedDateUtc",
"maintainers",
"TIMESTAMP",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "TIMESTAMP",
oldDefaultValueSql: "current_timestamp()")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<DateTime>(
"ModifiedDateUtc",
"licenses",
"TIMESTAMP",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "TIMESTAMP",
oldDefaultValueSql: "current_timestamp() ON UPDATE current_timestamp()")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn);
migrationBuilder.AlterColumn<DateTime>(
"CreatedDateUtc",
"licenses",
"TIMESTAMP",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "TIMESTAMP",
oldDefaultValueSql: "current_timestamp()")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<DateTime>(
"ModifiedDateUtc",
"languages",
"TIMESTAMP",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "TIMESTAMP",
oldDefaultValueSql: "current_timestamp() ON UPDATE current_timestamp()")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn);
migrationBuilder.AlterColumn<DateTime>(
"CreatedDateUtc",
"languages",
"TIMESTAMP",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "TIMESTAMP",
oldDefaultValueSql: "current_timestamp()")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<DateTime>(
"CreatedDateUtc",
"forks",
"TIMESTAMP",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "TIMESTAMP",
oldDefaultValueSql: "current_timestamp()")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<DateTime>(
"CreatedDateUtc",
"filterlists_maintainers",
"TIMESTAMP",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "TIMESTAMP",
oldDefaultValueSql: "current_timestamp()")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<DateTime>(
"CreatedDateUtc",
"filterlists_languages",
"TIMESTAMP",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "TIMESTAMP",
oldDefaultValueSql: "current_timestamp()")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<DateTime>(
"ModifiedDateUtc",
"filterlists",
"TIMESTAMP",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "TIMESTAMP",
oldDefaultValueSql: "current_timestamp() ON UPDATE current_timestamp()")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn);
migrationBuilder.AlterColumn<DateTime>(
"CreatedDateUtc",
"filterlists",
"TIMESTAMP",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "TIMESTAMP",
oldDefaultValueSql: "current_timestamp()")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
}
}
}

View file

@ -2,14 +2,12 @@
using System;
using FilterLists.Data;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
namespace FilterLists.Api.Migrations
{
[UsedImplicitly]
[DbContext(typeof(FilterListsDbContext))]
internal class FilterListsDbContextModelSnapshot : ModelSnapshot
{
@ -17,21 +15,24 @@ protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn)
.HasAnnotation("ProductVersion", "2.0.2-rtm-10011");
.HasAnnotation("ProductVersion", "2.1.1-rtm-30846")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("FilterLists.Data.Entities.FilterList", b =>
{
b.Property<int>("Id")
b.Property<ushort>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("SMALLINT UNSIGNED");
.HasColumnType("SMALLINT UNSIGNED")
.HasAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
b.Property<string>("ChatUrl")
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedDateUtc")
b.Property<DateTime?>("CreatedDateUtc")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP");
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("current_timestamp()");
b.Property<string>("Description")
.HasColumnType("TEXT");
@ -61,14 +62,15 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.Property<string>("IssuesUrl")
.HasColumnType("TEXT");
b.Property<int?>("LicenseId")
.IsRequired()
b.Property<byte>("LicenseId")
.ValueGeneratedOnAdd()
.HasDefaultValue(5);
.HasDefaultValue((byte)5);
b.Property<DateTime>("ModifiedDateUtc")
b.Property<DateTime?>("ModifiedDateUtc")
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("TIMESTAMP");
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("current_timestamp() ON UPDATE current_timestamp()");
b.Property<string>("Name")
.IsRequired()
@ -85,7 +87,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.Property<string>("SubmissionUrl")
.HasColumnType("TEXT");
b.Property<int?>("SyntaxId");
b.Property<byte?>("SyntaxId");
b.Property<string>("ViewUrl")
.HasColumnType("TEXT");
@ -101,13 +103,15 @@ protected override void BuildModel(ModelBuilder modelBuilder)
modelBuilder.Entity("FilterLists.Data.Entities.Junctions.FilterListLanguage", b =>
{
b.Property<int>("FilterListId");
b.Property<ushort>("FilterListId");
b.Property<int>("LanguageId");
b.Property<ushort>("LanguageId");
b.Property<DateTime>("CreatedDateUtc")
b.Property<DateTime?>("CreatedDateUtc")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP");
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("current_timestamp()");
b.HasKey("FilterListId", "LanguageId");
@ -118,13 +122,15 @@ protected override void BuildModel(ModelBuilder modelBuilder)
modelBuilder.Entity("FilterLists.Data.Entities.Junctions.FilterListMaintainer", b =>
{
b.Property<int>("FilterListId");
b.Property<ushort>("FilterListId");
b.Property<int>("MaintainerId");
b.Property<ushort>("MaintainerId");
b.Property<DateTime>("CreatedDateUtc")
b.Property<DateTime?>("CreatedDateUtc")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP");
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("current_timestamp()");
b.HasKey("FilterListId", "MaintainerId");
@ -135,13 +141,15 @@ protected override void BuildModel(ModelBuilder modelBuilder)
modelBuilder.Entity("FilterLists.Data.Entities.Junctions.Fork", b =>
{
b.Property<int>("ForkFilterListId");
b.Property<ushort>("ForkFilterListId");
b.Property<int>("UpstreamFilterListId");
b.Property<ushort>("UpstreamFilterListId");
b.Property<DateTime>("CreatedDateUtc")
b.Property<DateTime?>("CreatedDateUtc")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP");
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("current_timestamp()");
b.HasKey("ForkFilterListId", "UpstreamFilterListId");
@ -152,13 +160,15 @@ protected override void BuildModel(ModelBuilder modelBuilder)
modelBuilder.Entity("FilterLists.Data.Entities.Junctions.Merge", b =>
{
b.Property<int>("MergeFilterListId");
b.Property<ushort>("MergeFilterListId");
b.Property<int>("UpstreamFilterListId");
b.Property<ushort>("UpstreamFilterListId");
b.Property<DateTime>("CreatedDateUtc")
b.Property<DateTime?>("CreatedDateUtc")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP");
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("current_timestamp()");
b.HasKey("MergeFilterListId", "UpstreamFilterListId");
@ -169,19 +179,23 @@ protected override void BuildModel(ModelBuilder modelBuilder)
modelBuilder.Entity("FilterLists.Data.Entities.Junctions.SnapshotRule", b =>
{
b.Property<int>("AddedBySnapshotId");
b.Property<uint>("AddedBySnapshotId");
b.Property<int>("RuleId");
b.Property<uint>("RuleId");
b.Property<DateTime>("CreatedDateUtc")
b.Property<DateTime?>("CreatedDateUtc")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP");
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("current_timestamp()");
b.Property<DateTime>("ModifiedDateUtc")
b.Property<DateTime?>("ModifiedDateUtc")
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("TIMESTAMP");
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("current_timestamp() ON UPDATE current_timestamp()");
b.Property<int?>("RemovedBySnapshotId");
b.Property<uint?>("RemovedBySnapshotId");
b.HasKey("AddedBySnapshotId", "RuleId");
@ -194,13 +208,15 @@ protected override void BuildModel(ModelBuilder modelBuilder)
modelBuilder.Entity("FilterLists.Data.Entities.Junctions.SoftwareSyntax", b =>
{
b.Property<int>("SyntaxId");
b.Property<byte>("SyntaxId");
b.Property<int>("SoftwareId");
b.Property<byte>("SoftwareId");
b.Property<DateTime>("CreatedDateUtc")
b.Property<DateTime?>("CreatedDateUtc")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP");
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("current_timestamp()");
b.HasKey("SyntaxId", "SoftwareId");
@ -211,13 +227,16 @@ protected override void BuildModel(ModelBuilder modelBuilder)
modelBuilder.Entity("FilterLists.Data.Entities.Language", b =>
{
b.Property<int>("Id")
b.Property<ushort>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("SMALLINT UNSIGNED");
.HasColumnType("SMALLINT UNSIGNED")
.HasAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
b.Property<DateTime>("CreatedDateUtc")
b.Property<DateTime?>("CreatedDateUtc")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP");
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("current_timestamp()");
b.Property<string>("Iso6391")
.ValueGeneratedOnAdd()
@ -249,9 +268,11 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.HasColumnType("VARCHAR(126)")
.HasDefaultValueSql("NULL");
b.Property<DateTime>("ModifiedDateUtc")
b.Property<DateTime?>("ModifiedDateUtc")
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("TIMESTAMP");
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("current_timestamp() ON UPDATE current_timestamp()");
b.Property<string>("Name")
.ValueGeneratedOnAdd()
@ -265,20 +286,25 @@ protected override void BuildModel(ModelBuilder modelBuilder)
modelBuilder.Entity("FilterLists.Data.Entities.License", b =>
{
b.Property<int>("Id")
b.Property<byte>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TINYINT UNSIGNED");
.HasColumnType("TINYINT UNSIGNED")
.HasAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
b.Property<DateTime>("CreatedDateUtc")
b.Property<DateTime?>("CreatedDateUtc")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP");
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("current_timestamp()");
b.Property<string>("DescriptionUrl")
.HasColumnType("TEXT");
b.Property<DateTime>("ModifiedDateUtc")
b.Property<DateTime?>("ModifiedDateUtc")
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("TIMESTAMP");
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("current_timestamp() ON UPDATE current_timestamp()");
b.Property<string>("Name")
.IsRequired()
@ -295,13 +321,16 @@ protected override void BuildModel(ModelBuilder modelBuilder)
modelBuilder.Entity("FilterLists.Data.Entities.Maintainer", b =>
{
b.Property<int>("Id")
b.Property<ushort>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("SMALLINT UNSIGNED");
.HasColumnType("SMALLINT UNSIGNED")
.HasAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
b.Property<DateTime>("CreatedDateUtc")
b.Property<DateTime?>("CreatedDateUtc")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP");
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("current_timestamp()");
b.Property<string>("EmailAddress")
.ValueGeneratedOnAdd()
@ -311,9 +340,11 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.Property<string>("HomeUrl")
.HasColumnType("TEXT");
b.Property<DateTime>("ModifiedDateUtc")
b.Property<DateTime?>("ModifiedDateUtc")
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("TIMESTAMP");
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("current_timestamp() ON UPDATE current_timestamp()");
b.Property<string>("Name")
.IsRequired()
@ -331,13 +362,16 @@ protected override void BuildModel(ModelBuilder modelBuilder)
modelBuilder.Entity("FilterLists.Data.Entities.Rule", b =>
{
b.Property<int>("Id")
b.Property<uint>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INT UNSIGNED");
.HasColumnType("INT UNSIGNED")
.HasAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
b.Property<DateTime>("CreatedDateUtc")
b.Property<DateTime?>("CreatedDateUtc")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP");
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("current_timestamp()");
b.Property<string>("Raw")
.IsRequired()
@ -350,15 +384,18 @@ protected override void BuildModel(ModelBuilder modelBuilder)
modelBuilder.Entity("FilterLists.Data.Entities.Snapshot", b =>
{
b.Property<int>("Id")
b.Property<uint>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("MEDIUMINT UNSIGNED");
.HasColumnType("MEDIUMINT UNSIGNED")
.HasAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
b.Property<DateTime>("CreatedDateUtc")
b.Property<DateTime?>("CreatedDateUtc")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP");
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("current_timestamp()");
b.Property<int>("FilterListId");
b.Property<ushort>("FilterListId");
b.Property<string>("HttpStatusCode")
.ValueGeneratedOnAdd()
@ -367,10 +404,11 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.Property<bool>("IsCompleted");
b.Property<DateTime>("ModifiedDateUtc")
b.Property<DateTime?>("ModifiedDateUtc")
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("CURRENT_TIMESTAMP()");
.HasDefaultValueSql("current_timestamp() ON UPDATE current_timestamp()");
b.HasKey("Id");
@ -381,13 +419,16 @@ protected override void BuildModel(ModelBuilder modelBuilder)
modelBuilder.Entity("FilterLists.Data.Entities.Software", b =>
{
b.Property<int>("Id")
b.Property<byte>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TINYINT UNSIGNED");
.HasColumnType("TINYINT UNSIGNED")
.HasAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
b.Property<DateTime>("CreatedDateUtc")
b.Property<DateTime?>("CreatedDateUtc")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP");
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("current_timestamp()");
b.Property<string>("DownloadUrl")
.HasColumnType("TEXT");
@ -395,9 +436,11 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.Property<string>("HomeUrl")
.HasColumnType("TEXT");
b.Property<DateTime>("ModifiedDateUtc")
b.Property<DateTime?>("ModifiedDateUtc")
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("TIMESTAMP");
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("current_timestamp() ON UPDATE current_timestamp()");
b.Property<string>("Name")
.IsRequired()
@ -410,20 +453,25 @@ protected override void BuildModel(ModelBuilder modelBuilder)
modelBuilder.Entity("FilterLists.Data.Entities.Syntax", b =>
{
b.Property<int>("Id")
b.Property<byte>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TINYINT UNSIGNED");
.HasColumnType("TINYINT UNSIGNED")
.HasAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
b.Property<DateTime>("CreatedDateUtc")
b.Property<DateTime?>("CreatedDateUtc")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP");
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("current_timestamp()");
b.Property<string>("DefinitionUrl")
.HasColumnType("TEXT");
b.Property<DateTime>("ModifiedDateUtc")
b.Property<DateTime?>("ModifiedDateUtc")
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("TIMESTAMP");
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("current_timestamp() ON UPDATE current_timestamp()");
b.Property<string>("Name")
.IsRequired()

View file

@ -5,7 +5,7 @@ namespace FilterLists.Data.Entities
public class BaseEntity : IBaseEntity
{
public uint Id { get; set; }
public DateTime CreatedDateUtc { get; set; }
public DateTime ModifiedDateUtc { get; set; }
public DateTime? CreatedDateUtc { get; set; }
public DateTime? ModifiedDateUtc { get; set; }
}
}

View file

@ -4,6 +4,6 @@ namespace FilterLists.Data.Entities
{
public interface IBaseEntity
{
DateTime CreatedDateUtc { get; set; }
DateTime? CreatedDateUtc { get; set; }
}
}

View file

@ -4,6 +4,6 @@ namespace FilterLists.Data.Entities.Junctions
{
public class BaseJunctionEntity : IBaseEntity
{
public DateTime CreatedDateUtc { get; set; }
public DateTime? CreatedDateUtc { get; set; }
}
}

View file

@ -4,7 +4,7 @@ namespace FilterLists.Data.Entities.Junctions
{
public class SnapshotRule : BaseJunctionEntity
{
public DateTime ModifiedDateUtc { get; set; }
public DateTime? ModifiedDateUtc { get; set; }
public uint AddedBySnapshotId { get; set; }
public Snapshot AddedBySnapshot { get; set; }
public uint? RemovedBySnapshotId { get; set; }

View file

@ -13,10 +13,14 @@ public virtual void Configure(EntityTypeBuilder<TEntity> entityTypeBuilder)
.HasColumnType("SMALLINT UNSIGNED");
entityTypeBuilder.Property(x => x.CreatedDateUtc)
.HasColumnType("TIMESTAMP")
.ValueGeneratedOnAdd();
.ValueGeneratedOnAdd()
.IsRequired()
.HasDefaultValueSql("current_timestamp()");
entityTypeBuilder.Property(x => x.ModifiedDateUtc)
.HasColumnType("TIMESTAMP")
.ValueGeneratedOnAddOrUpdate();
.ValueGeneratedOnAddOrUpdate()
.IsRequired()
.HasDefaultValueSql("current_timestamp() ON UPDATE current_timestamp()");
}
}
}

View file

@ -8,6 +8,10 @@ public class BaseJunctionTypeConfiguration<TJunction> : IEntityTypeConfiguration
where TJunction : BaseJunctionEntity
{
public virtual void Configure(EntityTypeBuilder<TJunction> entityTypeBuilder) =>
entityTypeBuilder.Property(x => x.CreatedDateUtc).HasColumnType("TIMESTAMP").ValueGeneratedOnAdd();
entityTypeBuilder.Property(x => x.CreatedDateUtc)
.HasColumnType("TIMESTAMP")
.ValueGeneratedOnAdd()
.IsRequired()
.HasDefaultValueSql("current_timestamp()");
}
}

View file

@ -13,7 +13,9 @@ public override void Configure(EntityTypeBuilder<SnapshotRule> entityTypeBuilder
entityTypeBuilder.HasKey(x => new {x.AddedBySnapshotId, x.RuleId});
entityTypeBuilder.Property(x => x.ModifiedDateUtc)
.HasColumnType("TIMESTAMP")
.ValueGeneratedOnAddOrUpdate();
.ValueGeneratedOnAddOrUpdate()
.IsRequired()
.HasDefaultValueSql("current_timestamp() ON UPDATE current_timestamp()");
entityTypeBuilder.HasOne(x => x.AddedBySnapshot)
.WithMany(x => x.AddedSnapshotRules)
.HasForeignKey(x => x.AddedBySnapshotId);

View file

@ -12,8 +12,6 @@ public override void Configure(EntityTypeBuilder<Snapshot> entityTypeBuilder)
entityTypeBuilder.ToTable("snapshots");
entityTypeBuilder.Property(x => x.Id)
.HasColumnType("MEDIUMINT UNSIGNED");
entityTypeBuilder.Property(x => x.ModifiedDateUtc)
.HasDefaultValueSql("CURRENT_TIMESTAMP()");
entityTypeBuilder.Property(x => x.HttpStatusCode)
.HasColumnType("VARCHAR(3)")
.HasDefaultValueSql("NULL");