From ac6513a38ffe0c0194a5c683eb6833cd1fc699bf Mon Sep 17 00:00:00 2001 From: "Collin M. Barrett" Date: Sat, 27 Jan 2018 12:37:08 -0600 Subject: [PATCH] re-do initial create (fix timestamps) --- .../20180127171317_InitialCreate.cs | 388 ------------ ... 20180127183029_InitialCreate.Designer.cs} | 59 +- .../20180127183029_InitialCreate.cs | 382 ++++++++++++ .../FilterListsDbContextModelSnapshot.cs | 553 +++++++++--------- .../FilterListTypeConfiguration.cs | 6 +- .../FilterListLanguageTypeConfiguration.cs | 3 +- .../FilterListMaintainerTypeConfiguration.cs | 3 +- .../FilterListRuleTypeConfiguration.cs | 3 +- .../Junctions/ForkTypeConfiguration.cs | 3 +- .../Junctions/MergeTypeConfiguration.cs | 3 +- .../SoftwareSyntaxTypeConfiguration.cs | 3 +- .../LanguageTypeConfiguration.cs | 6 +- .../LicenseTypeConfiguration.cs | 6 +- .../MaintainerTypeConfiguration.cs | 6 +- .../RuleTypeConfiguration.cs | 3 +- .../SoftwareTypeConfiguration.cs | 6 +- .../SyntaxTypeConfiguration.cs | 8 +- 17 files changed, 745 insertions(+), 696 deletions(-) delete mode 100644 src/FilterLists.Api/Migrations/20180127171317_InitialCreate.cs rename src/FilterLists.Api/Migrations/{20180127171317_InitialCreate.Designer.cs => 20180127183029_InitialCreate.Designer.cs} (87%) create mode 100644 src/FilterLists.Api/Migrations/20180127183029_InitialCreate.cs diff --git a/src/FilterLists.Api/Migrations/20180127171317_InitialCreate.cs b/src/FilterLists.Api/Migrations/20180127171317_InitialCreate.cs deleted file mode 100644 index df4844de6..000000000 --- a/src/FilterLists.Api/Migrations/20180127171317_InitialCreate.cs +++ /dev/null @@ -1,388 +0,0 @@ -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using System; -using System.Collections.Generic; - -namespace FilterLists.Api.Migrations -{ - public partial class InitialCreate : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "languages", - columns: table => new - { - Id = table.Column(type: "SMALLINT UNSIGNED", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - CreatedDateUtc = table.Column(type: "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", nullable: false), - Iso6391 = table.Column(type: "NVARCHAR(2)", nullable: true), - Iso6392 = table.Column(type: "NVARCHAR(3)", nullable: true), - Iso6392B = table.Column(type: "NVARCHAR(3)", nullable: true), - Iso6392T = table.Column(type: "NVARCHAR(3)", nullable: true), - Iso6393 = table.Column(type: "NVARCHAR(3)", nullable: true), - LocalName = table.Column(type: "NVARCHAR(126)", nullable: true), - ModifiedDateUtc = table.Column(type: "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP", nullable: false), - Name = table.Column(type: "NVARCHAR(126)", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_languages", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "licenses", - columns: table => new - { - Id = table.Column(type: "SMALLINT UNSIGNED", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - CreatedDateUtc = table.Column(type: "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", nullable: false), - DescriptionUrl = table.Column(type: "TEXT", nullable: true), - ModifiedDateUtc = table.Column(type: "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP", nullable: false), - Name = table.Column(type: "NVARCHAR(126) NOT NULL", nullable: true), - PermissiveAdaptation = table.Column(nullable: false), - PermissiveCommercial = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_licenses", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "maintainers", - columns: table => new - { - Id = table.Column(type: "SMALLINT UNSIGNED", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - CreatedDateUtc = table.Column(type: "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", nullable: false), - EmailAddress = table.Column(type: "NVARCHAR(126)", nullable: true), - HomeUrl = table.Column(type: "TEXT", nullable: true), - ModifiedDateUtc = table.Column(type: "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP", nullable: false), - Name = table.Column(type: "NVARCHAR(126) NOT NULL", nullable: true), - TwitterHandle = table.Column(type: "NVARCHAR(126)", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_maintainers", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "rules", - columns: table => new - { - Id = table.Column(type: "BIGINT UNSIGNED", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - CreatedDateUtc = table.Column(type: "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", nullable: false), - Raw = table.Column(type: "NVARCHAR(2083) NOT NULL", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_rules", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "software", - columns: table => new - { - Id = table.Column(type: "SMALLINT UNSIGNED", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - CreatedDateUtc = table.Column(type: "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", nullable: false), - DownloadUrl = table.Column(type: "TEXT", nullable: true), - HomeUrl = table.Column(type: "TEXT", nullable: true), - ModifiedDateUtc = table.Column(type: "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP", nullable: false), - Name = table.Column(type: "NVARCHAR(126) NOT NULL", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_software", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "syntaxes", - columns: table => new - { - Id = table.Column(type: "SMALLINT UNSIGNED", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - CreatedDateUtc = table.Column(type: "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", nullable: false), - DefinitionUrl = table.Column(type: "TEXT", nullable: true), - ModifiedDateUtc = table.Column(type: "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP", nullable: false), - Name = table.Column(type: "NVARCHAR(126) NOT NULL", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_syntaxes", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "filterlists", - columns: table => new - { - Id = table.Column(type: "SMALLINT UNSIGNED", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - CreatedDateUtc = table.Column(type: "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", nullable: false), - Description = table.Column(type: "TEXT", nullable: true), - DescriptionSourceUrl = table.Column(type: "TEXT", nullable: true), - DiscontinuedDate = table.Column(nullable: true), - DonateUrl = table.Column(type: "TEXT", nullable: true), - EmailAddress = table.Column(type: "NVARCHAR(126)", nullable: true), - ForumUrl = table.Column(type: "TEXT", nullable: true), - HomeUrl = table.Column(type: "TEXT", nullable: true), - IssuesUrl = table.Column(type: "TEXT", nullable: true), - LicenseId = table.Column(nullable: true), - ModifiedDateUtc = table.Column(type: "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP", nullable: false), - Name = table.Column(type: "NVARCHAR(126) NOT NULL", nullable: true), - SubmissionUrl = table.Column(type: "TEXT", nullable: true), - SyntaxId = table.Column(nullable: true), - ViewUrl = table.Column(type: "TEXT NOT NULL", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_filterlists", x => x.Id); - table.ForeignKey( - name: "FK_filterlists_licenses_LicenseId", - column: x => x.LicenseId, - principalTable: "licenses", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_filterlists_syntaxes_SyntaxId", - column: x => x.SyntaxId, - principalTable: "syntaxes", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "software_syntaxes", - columns: table => new - { - SoftwareId = table.Column(nullable: false), - SyntaxId = table.Column(nullable: false), - CreatedDateUtc = table.Column(type: "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_software_syntaxes", x => new { x.SoftwareId, x.SyntaxId }); - table.ForeignKey( - name: "FK_software_syntaxes_software_SoftwareId", - column: x => x.SoftwareId, - principalTable: "software", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_software_syntaxes_syntaxes_SyntaxId", - column: x => x.SyntaxId, - principalTable: "syntaxes", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "filterlists_languages", - columns: table => new - { - FilterListId = table.Column(nullable: false), - LanguageId = table.Column(nullable: false), - CreatedDateUtc = table.Column(type: "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_filterlists_languages", x => new { x.FilterListId, x.LanguageId }); - table.ForeignKey( - name: "FK_filterlists_languages_filterlists_FilterListId", - column: x => x.FilterListId, - principalTable: "filterlists", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_filterlists_languages_languages_LanguageId", - column: x => x.LanguageId, - principalTable: "languages", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "filterlists_maintainers", - columns: table => new - { - FilterListId = table.Column(nullable: false), - MaintainerId = table.Column(nullable: false), - CreatedDateUtc = table.Column(type: "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_filterlists_maintainers", x => new { x.FilterListId, x.MaintainerId }); - table.ForeignKey( - name: "FK_filterlists_maintainers_filterlists_FilterListId", - column: x => x.FilterListId, - principalTable: "filterlists", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_filterlists_maintainers_maintainers_MaintainerId", - column: x => x.MaintainerId, - principalTable: "maintainers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "filterlists_rules", - columns: table => new - { - FilterListId = table.Column(nullable: false), - RuleId = table.Column(nullable: false), - CreatedDateUtc = table.Column(type: "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_filterlists_rules", x => new { x.FilterListId, x.RuleId }); - table.ForeignKey( - name: "FK_filterlists_rules_filterlists_FilterListId", - column: x => x.FilterListId, - principalTable: "filterlists", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_filterlists_rules_rules_RuleId", - column: x => x.RuleId, - principalTable: "rules", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "forks", - columns: table => new - { - ForkFilterListId = table.Column(nullable: false), - UpstreamFilterListId = table.Column(nullable: false), - CreatedDateUtc = table.Column(type: "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_forks", x => new { x.ForkFilterListId, x.UpstreamFilterListId }); - table.ForeignKey( - name: "FK_forks_filterlists_ForkFilterListId", - column: x => x.ForkFilterListId, - principalTable: "filterlists", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_forks_filterlists_UpstreamFilterListId", - column: x => x.UpstreamFilterListId, - principalTable: "filterlists", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "merges", - columns: table => new - { - MergeFilterListId = table.Column(nullable: false), - UpstreamFilterListId = table.Column(nullable: false), - CreatedDateUtc = table.Column(type: "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_merges", x => new { x.MergeFilterListId, x.UpstreamFilterListId }); - table.ForeignKey( - name: "FK_merges_filterlists_MergeFilterListId", - column: x => x.MergeFilterListId, - principalTable: "filterlists", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_merges_filterlists_UpstreamFilterListId", - column: x => x.UpstreamFilterListId, - principalTable: "filterlists", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_filterlists_LicenseId", - table: "filterlists", - column: "LicenseId"); - - migrationBuilder.CreateIndex( - name: "IX_filterlists_SyntaxId", - table: "filterlists", - column: "SyntaxId"); - - migrationBuilder.CreateIndex( - name: "IX_filterlists_languages_LanguageId", - table: "filterlists_languages", - column: "LanguageId"); - - migrationBuilder.CreateIndex( - name: "IX_filterlists_maintainers_MaintainerId", - table: "filterlists_maintainers", - column: "MaintainerId"); - - migrationBuilder.CreateIndex( - name: "IX_filterlists_rules_RuleId", - table: "filterlists_rules", - column: "RuleId"); - - migrationBuilder.CreateIndex( - name: "IX_forks_UpstreamFilterListId", - table: "forks", - column: "UpstreamFilterListId"); - - migrationBuilder.CreateIndex( - name: "IX_merges_UpstreamFilterListId", - table: "merges", - column: "UpstreamFilterListId"); - - migrationBuilder.CreateIndex( - name: "IX_software_syntaxes_SyntaxId", - table: "software_syntaxes", - column: "SyntaxId"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "filterlists_languages"); - - migrationBuilder.DropTable( - name: "filterlists_maintainers"); - - migrationBuilder.DropTable( - name: "filterlists_rules"); - - migrationBuilder.DropTable( - name: "forks"); - - migrationBuilder.DropTable( - name: "merges"); - - migrationBuilder.DropTable( - name: "software_syntaxes"); - - migrationBuilder.DropTable( - name: "languages"); - - migrationBuilder.DropTable( - name: "maintainers"); - - migrationBuilder.DropTable( - name: "rules"); - - migrationBuilder.DropTable( - name: "filterlists"); - - migrationBuilder.DropTable( - name: "software"); - - migrationBuilder.DropTable( - name: "licenses"); - - migrationBuilder.DropTable( - name: "syntaxes"); - } - } -} diff --git a/src/FilterLists.Api/Migrations/20180127171317_InitialCreate.Designer.cs b/src/FilterLists.Api/Migrations/20180127183029_InitialCreate.Designer.cs similarity index 87% rename from src/FilterLists.Api/Migrations/20180127171317_InitialCreate.Designer.cs rename to src/FilterLists.Api/Migrations/20180127183029_InitialCreate.Designer.cs index 6320a1d49..7f19b4db0 100644 --- a/src/FilterLists.Api/Migrations/20180127171317_InitialCreate.Designer.cs +++ b/src/FilterLists.Api/Migrations/20180127183029_InitialCreate.Designer.cs @@ -11,7 +11,7 @@ namespace FilterLists.Api.Migrations { [DbContext(typeof(FilterListsDbContext))] - [Migration("20180127171317_InitialCreate")] + [Migration("20180127183029_InitialCreate")] partial class InitialCreate { protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -28,7 +28,8 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("SMALLINT UNSIGNED"); b.Property("CreatedDateUtc") - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP"); + .ValueGeneratedOnAdd() + .HasColumnType("TIMESTAMP"); b.Property("Description") .HasColumnType("TEXT"); @@ -56,7 +57,8 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("LicenseId"); b.Property("ModifiedDateUtc") - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"); + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("TIMESTAMP"); b.Property("Name") .HasColumnType("NVARCHAR(126) NOT NULL"); @@ -85,7 +87,8 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("LanguageId"); b.Property("CreatedDateUtc") - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP"); + .ValueGeneratedOnAdd() + .HasColumnType("TIMESTAMP"); b.HasKey("FilterListId", "LanguageId"); @@ -101,7 +104,8 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("MaintainerId"); b.Property("CreatedDateUtc") - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP"); + .ValueGeneratedOnAdd() + .HasColumnType("TIMESTAMP"); b.HasKey("FilterListId", "MaintainerId"); @@ -117,7 +121,8 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("RuleId"); b.Property("CreatedDateUtc") - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP"); + .ValueGeneratedOnAdd() + .HasColumnType("TIMESTAMP"); b.HasKey("FilterListId", "RuleId"); @@ -133,7 +138,8 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("UpstreamFilterListId"); b.Property("CreatedDateUtc") - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP"); + .ValueGeneratedOnAdd() + .HasColumnType("TIMESTAMP"); b.HasKey("ForkFilterListId", "UpstreamFilterListId"); @@ -149,7 +155,8 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("UpstreamFilterListId"); b.Property("CreatedDateUtc") - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP"); + .ValueGeneratedOnAdd() + .HasColumnType("TIMESTAMP"); b.HasKey("MergeFilterListId", "UpstreamFilterListId"); @@ -165,7 +172,8 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("SyntaxId"); b.Property("CreatedDateUtc") - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP"); + .ValueGeneratedOnAdd() + .HasColumnType("TIMESTAMP"); b.HasKey("SoftwareId", "SyntaxId"); @@ -181,7 +189,8 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("SMALLINT UNSIGNED"); b.Property("CreatedDateUtc") - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP"); + .ValueGeneratedOnAdd() + .HasColumnType("TIMESTAMP"); b.Property("Iso6391") .HasColumnType("NVARCHAR(2)"); @@ -202,7 +211,8 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("NVARCHAR(126)"); b.Property("ModifiedDateUtc") - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"); + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("TIMESTAMP"); b.Property("Name") .HasColumnType("NVARCHAR(126)"); @@ -219,13 +229,15 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("SMALLINT UNSIGNED"); b.Property("CreatedDateUtc") - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP"); + .ValueGeneratedOnAdd() + .HasColumnType("TIMESTAMP"); b.Property("DescriptionUrl") .HasColumnType("TEXT"); b.Property("ModifiedDateUtc") - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"); + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("TIMESTAMP"); b.Property("Name") .HasColumnType("NVARCHAR(126) NOT NULL"); @@ -246,7 +258,8 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("SMALLINT UNSIGNED"); b.Property("CreatedDateUtc") - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP"); + .ValueGeneratedOnAdd() + .HasColumnType("TIMESTAMP"); b.Property("EmailAddress") .HasColumnType("NVARCHAR(126)"); @@ -255,7 +268,8 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("TEXT"); b.Property("ModifiedDateUtc") - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"); + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("TIMESTAMP"); b.Property("Name") .HasColumnType("NVARCHAR(126) NOT NULL"); @@ -275,7 +289,8 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("BIGINT UNSIGNED"); b.Property("CreatedDateUtc") - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP"); + .ValueGeneratedOnAdd() + .HasColumnType("TIMESTAMP"); b.Property("Raw") .HasColumnType("NVARCHAR(2083) NOT NULL"); @@ -292,7 +307,8 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("SMALLINT UNSIGNED"); b.Property("CreatedDateUtc") - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP"); + .ValueGeneratedOnAdd() + .HasColumnType("TIMESTAMP"); b.Property("DownloadUrl") .HasColumnType("TEXT"); @@ -301,7 +317,8 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("TEXT"); b.Property("ModifiedDateUtc") - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"); + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("TIMESTAMP"); b.Property("Name") .HasColumnType("NVARCHAR(126) NOT NULL"); @@ -318,13 +335,15 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("SMALLINT UNSIGNED"); b.Property("CreatedDateUtc") - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP"); + .ValueGeneratedOnAdd() + .HasColumnType("TIMESTAMP"); b.Property("DefinitionUrl") .HasColumnType("TEXT"); b.Property("ModifiedDateUtc") - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"); + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("TIMESTAMP"); b.Property("Name") .HasColumnType("NVARCHAR(126) NOT NULL"); diff --git a/src/FilterLists.Api/Migrations/20180127183029_InitialCreate.cs b/src/FilterLists.Api/Migrations/20180127183029_InitialCreate.cs new file mode 100644 index 000000000..0f7a1bdb8 --- /dev/null +++ b/src/FilterLists.Api/Migrations/20180127183029_InitialCreate.cs @@ -0,0 +1,382 @@ +using System; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace FilterLists.Api.Migrations +{ + public partial class InitialCreate : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + "languages", + table => new + { + Id = table.Column("SMALLINT UNSIGNED", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + CreatedDateUtc = table.Column("TIMESTAMP", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Iso6391 = table.Column("NVARCHAR(2)", nullable: true), + Iso6392 = table.Column("NVARCHAR(3)", nullable: true), + Iso6392B = table.Column("NVARCHAR(3)", nullable: true), + Iso6392T = table.Column("NVARCHAR(3)", nullable: true), + Iso6393 = table.Column("NVARCHAR(3)", nullable: true), + LocalName = table.Column("NVARCHAR(126)", nullable: true), + ModifiedDateUtc = table.Column("TIMESTAMP", nullable: false), + Name = table.Column("NVARCHAR(126)", nullable: true) + }, + constraints: table => { table.PrimaryKey("PK_languages", x => x.Id); }); + + migrationBuilder.CreateTable( + "licenses", + table => new + { + Id = table.Column("SMALLINT UNSIGNED", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + CreatedDateUtc = table.Column("TIMESTAMP", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + DescriptionUrl = table.Column("TEXT", nullable: true), + ModifiedDateUtc = table.Column("TIMESTAMP", nullable: false), + Name = table.Column("NVARCHAR(126) NOT NULL", nullable: true), + PermissiveAdaptation = table.Column(nullable: false), + PermissiveCommercial = table.Column(nullable: false) + }, + constraints: table => { table.PrimaryKey("PK_licenses", x => x.Id); }); + + migrationBuilder.CreateTable( + "maintainers", + table => new + { + Id = table.Column("SMALLINT UNSIGNED", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + CreatedDateUtc = table.Column("TIMESTAMP", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + EmailAddress = table.Column("NVARCHAR(126)", nullable: true), + HomeUrl = table.Column("TEXT", nullable: true), + ModifiedDateUtc = table.Column("TIMESTAMP", nullable: false), + Name = table.Column("NVARCHAR(126) NOT NULL", nullable: true), + TwitterHandle = table.Column("NVARCHAR(126)", nullable: true) + }, + constraints: table => { table.PrimaryKey("PK_maintainers", x => x.Id); }); + + migrationBuilder.CreateTable( + "rules", + table => new + { + Id = table.Column("BIGINT UNSIGNED", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + CreatedDateUtc = table.Column("TIMESTAMP", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Raw = table.Column("NVARCHAR(2083) NOT NULL", nullable: true) + }, + constraints: table => { table.PrimaryKey("PK_rules", x => x.Id); }); + + migrationBuilder.CreateTable( + "software", + table => new + { + Id = table.Column("SMALLINT UNSIGNED", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + CreatedDateUtc = table.Column("TIMESTAMP", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + DownloadUrl = table.Column("TEXT", nullable: true), + HomeUrl = table.Column("TEXT", nullable: true), + ModifiedDateUtc = table.Column("TIMESTAMP", nullable: false), + Name = table.Column("NVARCHAR(126) NOT NULL", nullable: true) + }, + constraints: table => { table.PrimaryKey("PK_software", x => x.Id); }); + + migrationBuilder.CreateTable( + "syntaxes", + table => new + { + Id = table.Column("SMALLINT UNSIGNED", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + CreatedDateUtc = table.Column("TIMESTAMP", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + DefinitionUrl = table.Column("TEXT", nullable: true), + ModifiedDateUtc = table.Column("TIMESTAMP", nullable: false), + Name = table.Column("NVARCHAR(126) NOT NULL", nullable: true) + }, + constraints: table => { table.PrimaryKey("PK_syntaxes", x => x.Id); }); + + migrationBuilder.CreateTable( + "filterlists", + table => new + { + Id = table.Column("SMALLINT UNSIGNED", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + CreatedDateUtc = table.Column("TIMESTAMP", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Description = table.Column("TEXT", nullable: true), + DescriptionSourceUrl = table.Column("TEXT", nullable: true), + DiscontinuedDate = table.Column(nullable: true), + DonateUrl = table.Column("TEXT", nullable: true), + EmailAddress = table.Column("NVARCHAR(126)", nullable: true), + ForumUrl = table.Column("TEXT", nullable: true), + HomeUrl = table.Column("TEXT", nullable: true), + IssuesUrl = table.Column("TEXT", nullable: true), + LicenseId = table.Column(nullable: true), + ModifiedDateUtc = table.Column("TIMESTAMP", nullable: false), + Name = table.Column("NVARCHAR(126) NOT NULL", nullable: true), + SubmissionUrl = table.Column("TEXT", nullable: true), + SyntaxId = table.Column(nullable: true), + ViewUrl = table.Column("TEXT NOT NULL", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_filterlists", x => x.Id); + table.ForeignKey( + "FK_filterlists_licenses_LicenseId", + x => x.LicenseId, + "licenses", + "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + "FK_filterlists_syntaxes_SyntaxId", + x => x.SyntaxId, + "syntaxes", + "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + "software_syntaxes", + table => new + { + SoftwareId = table.Column(nullable: false), + SyntaxId = table.Column(nullable: false), + CreatedDateUtc = table.Column("TIMESTAMP", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn) + }, + constraints: table => + { + table.PrimaryKey("PK_software_syntaxes", x => new {x.SoftwareId, x.SyntaxId}); + table.ForeignKey( + "FK_software_syntaxes_software_SoftwareId", + x => x.SoftwareId, + "software", + "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + "FK_software_syntaxes_syntaxes_SyntaxId", + x => x.SyntaxId, + "syntaxes", + "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + "filterlists_languages", + table => new + { + FilterListId = table.Column(nullable: false), + LanguageId = table.Column(nullable: false), + CreatedDateUtc = table.Column("TIMESTAMP", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn) + }, + constraints: table => + { + table.PrimaryKey("PK_filterlists_languages", x => new {x.FilterListId, x.LanguageId}); + table.ForeignKey( + "FK_filterlists_languages_filterlists_FilterListId", + x => x.FilterListId, + "filterlists", + "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + "FK_filterlists_languages_languages_LanguageId", + x => x.LanguageId, + "languages", + "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + "filterlists_maintainers", + table => new + { + FilterListId = table.Column(nullable: false), + MaintainerId = table.Column(nullable: false), + CreatedDateUtc = table.Column("TIMESTAMP", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn) + }, + constraints: table => + { + table.PrimaryKey("PK_filterlists_maintainers", x => new {x.FilterListId, x.MaintainerId}); + table.ForeignKey( + "FK_filterlists_maintainers_filterlists_FilterListId", + x => x.FilterListId, + "filterlists", + "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + "FK_filterlists_maintainers_maintainers_MaintainerId", + x => x.MaintainerId, + "maintainers", + "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + "filterlists_rules", + table => new + { + FilterListId = table.Column(nullable: false), + RuleId = table.Column(nullable: false), + CreatedDateUtc = table.Column("TIMESTAMP", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn) + }, + constraints: table => + { + table.PrimaryKey("PK_filterlists_rules", x => new {x.FilterListId, x.RuleId}); + table.ForeignKey( + "FK_filterlists_rules_filterlists_FilterListId", + x => x.FilterListId, + "filterlists", + "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + "FK_filterlists_rules_rules_RuleId", + x => x.RuleId, + "rules", + "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + "forks", + table => new + { + ForkFilterListId = table.Column(nullable: false), + UpstreamFilterListId = table.Column(nullable: false), + CreatedDateUtc = table.Column("TIMESTAMP", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn) + }, + constraints: table => + { + table.PrimaryKey("PK_forks", x => new {x.ForkFilterListId, x.UpstreamFilterListId}); + table.ForeignKey( + "FK_forks_filterlists_ForkFilterListId", + x => x.ForkFilterListId, + "filterlists", + "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + "FK_forks_filterlists_UpstreamFilterListId", + x => x.UpstreamFilterListId, + "filterlists", + "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + "merges", + table => new + { + MergeFilterListId = table.Column(nullable: false), + UpstreamFilterListId = table.Column(nullable: false), + CreatedDateUtc = table.Column("TIMESTAMP", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn) + }, + constraints: table => + { + table.PrimaryKey("PK_merges", x => new {x.MergeFilterListId, x.UpstreamFilterListId}); + table.ForeignKey( + "FK_merges_filterlists_MergeFilterListId", + x => x.MergeFilterListId, + "filterlists", + "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + "FK_merges_filterlists_UpstreamFilterListId", + x => x.UpstreamFilterListId, + "filterlists", + "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + "IX_filterlists_LicenseId", + "filterlists", + "LicenseId"); + + migrationBuilder.CreateIndex( + "IX_filterlists_SyntaxId", + "filterlists", + "SyntaxId"); + + migrationBuilder.CreateIndex( + "IX_filterlists_languages_LanguageId", + "filterlists_languages", + "LanguageId"); + + migrationBuilder.CreateIndex( + "IX_filterlists_maintainers_MaintainerId", + "filterlists_maintainers", + "MaintainerId"); + + migrationBuilder.CreateIndex( + "IX_filterlists_rules_RuleId", + "filterlists_rules", + "RuleId"); + + migrationBuilder.CreateIndex( + "IX_forks_UpstreamFilterListId", + "forks", + "UpstreamFilterListId"); + + migrationBuilder.CreateIndex( + "IX_merges_UpstreamFilterListId", + "merges", + "UpstreamFilterListId"); + + migrationBuilder.CreateIndex( + "IX_software_syntaxes_SyntaxId", + "software_syntaxes", + "SyntaxId"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + "filterlists_languages"); + + migrationBuilder.DropTable( + "filterlists_maintainers"); + + migrationBuilder.DropTable( + "filterlists_rules"); + + migrationBuilder.DropTable( + "forks"); + + migrationBuilder.DropTable( + "merges"); + + migrationBuilder.DropTable( + "software_syntaxes"); + + migrationBuilder.DropTable( + "languages"); + + migrationBuilder.DropTable( + "maintainers"); + + migrationBuilder.DropTable( + "rules"); + + migrationBuilder.DropTable( + "filterlists"); + + migrationBuilder.DropTable( + "software"); + + migrationBuilder.DropTable( + "licenses"); + + migrationBuilder.DropTable( + "syntaxes"); + } + } +} \ No newline at end of file diff --git a/src/FilterLists.Api/Migrations/FilterListsDbContextModelSnapshot.cs b/src/FilterLists.Api/Migrations/FilterListsDbContextModelSnapshot.cs index fab777929..809a83891 100644 --- a/src/FilterLists.Api/Migrations/FilterListsDbContextModelSnapshot.cs +++ b/src/FilterLists.Api/Migrations/FilterListsDbContextModelSnapshot.cs @@ -1,17 +1,15 @@ // + +using System; using FilterLists.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage; -using Microsoft.EntityFrameworkCore.Storage.Internal; -using System; namespace FilterLists.Api.Migrations { [DbContext(typeof(FilterListsDbContext))] - partial class FilterListsDbContextModelSnapshot : ModelSnapshot + internal class FilterListsDbContextModelSnapshot : ModelSnapshot { protected override void BuildModel(ModelBuilder modelBuilder) { @@ -21,407 +19,426 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasAnnotation("ProductVersion", "2.0.1-rtm-125"); modelBuilder.Entity("FilterLists.Data.Entities.FilterList", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("SMALLINT UNSIGNED"); + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("SMALLINT UNSIGNED"); - b.Property("CreatedDateUtc") - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP"); + b.Property("CreatedDateUtc") + .ValueGeneratedOnAdd() + .HasColumnType("TIMESTAMP"); - b.Property("Description") - .HasColumnType("TEXT"); + b.Property("Description") + .HasColumnType("TEXT"); - b.Property("DescriptionSourceUrl") - .HasColumnType("TEXT"); + b.Property("DescriptionSourceUrl") + .HasColumnType("TEXT"); - b.Property("DiscontinuedDate"); + b.Property("DiscontinuedDate"); - b.Property("DonateUrl") - .HasColumnType("TEXT"); + b.Property("DonateUrl") + .HasColumnType("TEXT"); - b.Property("EmailAddress") - .HasColumnType("NVARCHAR(126)"); + b.Property("EmailAddress") + .HasColumnType("NVARCHAR(126)"); - b.Property("ForumUrl") - .HasColumnType("TEXT"); + b.Property("ForumUrl") + .HasColumnType("TEXT"); - b.Property("HomeUrl") - .HasColumnType("TEXT"); + b.Property("HomeUrl") + .HasColumnType("TEXT"); - b.Property("IssuesUrl") - .HasColumnType("TEXT"); + b.Property("IssuesUrl") + .HasColumnType("TEXT"); - b.Property("LicenseId"); + b.Property("LicenseId"); - b.Property("ModifiedDateUtc") - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"); + b.Property("ModifiedDateUtc") + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("TIMESTAMP"); - b.Property("Name") - .HasColumnType("NVARCHAR(126) NOT NULL"); + b.Property("Name") + .HasColumnType("NVARCHAR(126) NOT NULL"); - b.Property("SubmissionUrl") - .HasColumnType("TEXT"); + b.Property("SubmissionUrl") + .HasColumnType("TEXT"); - b.Property("SyntaxId"); + b.Property("SyntaxId"); - b.Property("ViewUrl") - .HasColumnType("TEXT NOT NULL"); + b.Property("ViewUrl") + .HasColumnType("TEXT NOT NULL"); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("LicenseId"); + b.HasIndex("LicenseId"); - b.HasIndex("SyntaxId"); + b.HasIndex("SyntaxId"); - b.ToTable("filterlists"); - }); + b.ToTable("filterlists"); + }); modelBuilder.Entity("FilterLists.Data.Entities.Junctions.FilterListLanguage", b => - { - b.Property("FilterListId"); + { + b.Property("FilterListId"); - b.Property("LanguageId"); + b.Property("LanguageId"); - b.Property("CreatedDateUtc") - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP"); + b.Property("CreatedDateUtc") + .ValueGeneratedOnAdd() + .HasColumnType("TIMESTAMP"); - b.HasKey("FilterListId", "LanguageId"); + b.HasKey("FilterListId", "LanguageId"); - b.HasIndex("LanguageId"); + b.HasIndex("LanguageId"); - b.ToTable("filterlists_languages"); - }); + b.ToTable("filterlists_languages"); + }); modelBuilder.Entity("FilterLists.Data.Entities.Junctions.FilterListMaintainer", b => - { - b.Property("FilterListId"); + { + b.Property("FilterListId"); - b.Property("MaintainerId"); + b.Property("MaintainerId"); - b.Property("CreatedDateUtc") - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP"); + b.Property("CreatedDateUtc") + .ValueGeneratedOnAdd() + .HasColumnType("TIMESTAMP"); - b.HasKey("FilterListId", "MaintainerId"); + b.HasKey("FilterListId", "MaintainerId"); - b.HasIndex("MaintainerId"); + b.HasIndex("MaintainerId"); - b.ToTable("filterlists_maintainers"); - }); + b.ToTable("filterlists_maintainers"); + }); modelBuilder.Entity("FilterLists.Data.Entities.Junctions.FilterListRule", b => - { - b.Property("FilterListId"); + { + b.Property("FilterListId"); - b.Property("RuleId"); + b.Property("RuleId"); - b.Property("CreatedDateUtc") - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP"); + b.Property("CreatedDateUtc") + .ValueGeneratedOnAdd() + .HasColumnType("TIMESTAMP"); - b.HasKey("FilterListId", "RuleId"); + b.HasKey("FilterListId", "RuleId"); - b.HasIndex("RuleId"); + b.HasIndex("RuleId"); - b.ToTable("filterlists_rules"); - }); + b.ToTable("filterlists_rules"); + }); modelBuilder.Entity("FilterLists.Data.Entities.Junctions.Fork", b => - { - b.Property("ForkFilterListId"); + { + b.Property("ForkFilterListId"); - b.Property("UpstreamFilterListId"); + b.Property("UpstreamFilterListId"); - b.Property("CreatedDateUtc") - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP"); + b.Property("CreatedDateUtc") + .ValueGeneratedOnAdd() + .HasColumnType("TIMESTAMP"); - b.HasKey("ForkFilterListId", "UpstreamFilterListId"); + b.HasKey("ForkFilterListId", "UpstreamFilterListId"); - b.HasIndex("UpstreamFilterListId"); + b.HasIndex("UpstreamFilterListId"); - b.ToTable("forks"); - }); + b.ToTable("forks"); + }); modelBuilder.Entity("FilterLists.Data.Entities.Junctions.Merge", b => - { - b.Property("MergeFilterListId"); + { + b.Property("MergeFilterListId"); - b.Property("UpstreamFilterListId"); + b.Property("UpstreamFilterListId"); - b.Property("CreatedDateUtc") - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP"); + b.Property("CreatedDateUtc") + .ValueGeneratedOnAdd() + .HasColumnType("TIMESTAMP"); - b.HasKey("MergeFilterListId", "UpstreamFilterListId"); + b.HasKey("MergeFilterListId", "UpstreamFilterListId"); - b.HasIndex("UpstreamFilterListId"); + b.HasIndex("UpstreamFilterListId"); - b.ToTable("merges"); - }); + b.ToTable("merges"); + }); modelBuilder.Entity("FilterLists.Data.Entities.Junctions.SoftwareSyntax", b => - { - b.Property("SoftwareId"); + { + b.Property("SoftwareId"); - b.Property("SyntaxId"); + b.Property("SyntaxId"); - b.Property("CreatedDateUtc") - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP"); + b.Property("CreatedDateUtc") + .ValueGeneratedOnAdd() + .HasColumnType("TIMESTAMP"); - b.HasKey("SoftwareId", "SyntaxId"); + b.HasKey("SoftwareId", "SyntaxId"); - b.HasIndex("SyntaxId"); + b.HasIndex("SyntaxId"); - b.ToTable("software_syntaxes"); - }); + b.ToTable("software_syntaxes"); + }); modelBuilder.Entity("FilterLists.Data.Entities.Language", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("SMALLINT UNSIGNED"); + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("SMALLINT UNSIGNED"); - b.Property("CreatedDateUtc") - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP"); + b.Property("CreatedDateUtc") + .ValueGeneratedOnAdd() + .HasColumnType("TIMESTAMP"); - b.Property("Iso6391") - .HasColumnType("NVARCHAR(2)"); + b.Property("Iso6391") + .HasColumnType("NVARCHAR(2)"); - b.Property("Iso6392") - .HasColumnType("NVARCHAR(3)"); + b.Property("Iso6392") + .HasColumnType("NVARCHAR(3)"); - b.Property("Iso6392B") - .HasColumnType("NVARCHAR(3)"); + b.Property("Iso6392B") + .HasColumnType("NVARCHAR(3)"); - b.Property("Iso6392T") - .HasColumnType("NVARCHAR(3)"); + b.Property("Iso6392T") + .HasColumnType("NVARCHAR(3)"); - b.Property("Iso6393") - .HasColumnType("NVARCHAR(3)"); + b.Property("Iso6393") + .HasColumnType("NVARCHAR(3)"); - b.Property("LocalName") - .HasColumnType("NVARCHAR(126)"); + b.Property("LocalName") + .HasColumnType("NVARCHAR(126)"); - b.Property("ModifiedDateUtc") - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"); + b.Property("ModifiedDateUtc") + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("TIMESTAMP"); - b.Property("Name") - .HasColumnType("NVARCHAR(126)"); + b.Property("Name") + .HasColumnType("NVARCHAR(126)"); - b.HasKey("Id"); + b.HasKey("Id"); - b.ToTable("languages"); - }); + b.ToTable("languages"); + }); modelBuilder.Entity("FilterLists.Data.Entities.License", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("SMALLINT UNSIGNED"); + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("SMALLINT UNSIGNED"); - b.Property("CreatedDateUtc") - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP"); + b.Property("CreatedDateUtc") + .ValueGeneratedOnAdd() + .HasColumnType("TIMESTAMP"); - b.Property("DescriptionUrl") - .HasColumnType("TEXT"); + b.Property("DescriptionUrl") + .HasColumnType("TEXT"); - b.Property("ModifiedDateUtc") - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"); + b.Property("ModifiedDateUtc") + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("TIMESTAMP"); - b.Property("Name") - .HasColumnType("NVARCHAR(126) NOT NULL"); + b.Property("Name") + .HasColumnType("NVARCHAR(126) NOT NULL"); - b.Property("PermissiveAdaptation"); + b.Property("PermissiveAdaptation"); - b.Property("PermissiveCommercial"); + b.Property("PermissiveCommercial"); - b.HasKey("Id"); + b.HasKey("Id"); - b.ToTable("licenses"); - }); + b.ToTable("licenses"); + }); modelBuilder.Entity("FilterLists.Data.Entities.Maintainer", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("SMALLINT UNSIGNED"); + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("SMALLINT UNSIGNED"); - b.Property("CreatedDateUtc") - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP"); + b.Property("CreatedDateUtc") + .ValueGeneratedOnAdd() + .HasColumnType("TIMESTAMP"); - b.Property("EmailAddress") - .HasColumnType("NVARCHAR(126)"); + b.Property("EmailAddress") + .HasColumnType("NVARCHAR(126)"); - b.Property("HomeUrl") - .HasColumnType("TEXT"); + b.Property("HomeUrl") + .HasColumnType("TEXT"); - b.Property("ModifiedDateUtc") - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"); + b.Property("ModifiedDateUtc") + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("TIMESTAMP"); - b.Property("Name") - .HasColumnType("NVARCHAR(126) NOT NULL"); + b.Property("Name") + .HasColumnType("NVARCHAR(126) NOT NULL"); - b.Property("TwitterHandle") - .HasColumnType("NVARCHAR(126)"); + b.Property("TwitterHandle") + .HasColumnType("NVARCHAR(126)"); - b.HasKey("Id"); + b.HasKey("Id"); - b.ToTable("maintainers"); - }); + b.ToTable("maintainers"); + }); modelBuilder.Entity("FilterLists.Data.Entities.Rule", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("BIGINT UNSIGNED"); + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("BIGINT UNSIGNED"); - b.Property("CreatedDateUtc") - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP"); + b.Property("CreatedDateUtc") + .ValueGeneratedOnAdd() + .HasColumnType("TIMESTAMP"); - b.Property("Raw") - .HasColumnType("NVARCHAR(2083) NOT NULL"); + b.Property("Raw") + .HasColumnType("NVARCHAR(2083) NOT NULL"); - b.HasKey("Id"); + b.HasKey("Id"); - b.ToTable("rules"); - }); + b.ToTable("rules"); + }); modelBuilder.Entity("FilterLists.Data.Entities.Software", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("SMALLINT UNSIGNED"); + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("SMALLINT UNSIGNED"); - b.Property("CreatedDateUtc") - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP"); + b.Property("CreatedDateUtc") + .ValueGeneratedOnAdd() + .HasColumnType("TIMESTAMP"); - b.Property("DownloadUrl") - .HasColumnType("TEXT"); + b.Property("DownloadUrl") + .HasColumnType("TEXT"); - b.Property("HomeUrl") - .HasColumnType("TEXT"); + b.Property("HomeUrl") + .HasColumnType("TEXT"); - b.Property("ModifiedDateUtc") - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"); + b.Property("ModifiedDateUtc") + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("TIMESTAMP"); - b.Property("Name") - .HasColumnType("NVARCHAR(126) NOT NULL"); + b.Property("Name") + .HasColumnType("NVARCHAR(126) NOT NULL"); - b.HasKey("Id"); + b.HasKey("Id"); - b.ToTable("software"); - }); + b.ToTable("software"); + }); modelBuilder.Entity("FilterLists.Data.Entities.Syntax", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("SMALLINT UNSIGNED"); + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("SMALLINT UNSIGNED"); - b.Property("CreatedDateUtc") - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP"); + b.Property("CreatedDateUtc") + .ValueGeneratedOnAdd() + .HasColumnType("TIMESTAMP"); - b.Property("DefinitionUrl") - .HasColumnType("TEXT"); + b.Property("DefinitionUrl") + .HasColumnType("TEXT"); - b.Property("ModifiedDateUtc") - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"); + b.Property("ModifiedDateUtc") + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("TIMESTAMP"); - b.Property("Name") - .HasColumnType("NVARCHAR(126) NOT NULL"); + b.Property("Name") + .HasColumnType("NVARCHAR(126) NOT NULL"); - b.HasKey("Id"); + b.HasKey("Id"); - b.ToTable("syntaxes"); - }); + b.ToTable("syntaxes"); + }); modelBuilder.Entity("FilterLists.Data.Entities.FilterList", b => - { - b.HasOne("FilterLists.Data.Entities.License") - .WithMany("FilterLists") - .HasForeignKey("LicenseId"); + { + b.HasOne("FilterLists.Data.Entities.License") + .WithMany("FilterLists") + .HasForeignKey("LicenseId"); - b.HasOne("FilterLists.Data.Entities.Syntax") - .WithMany("FilterLists") - .HasForeignKey("SyntaxId"); - }); + b.HasOne("FilterLists.Data.Entities.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.FilterList", "FilterList") + .WithMany("FilterListLanguages") + .HasForeignKey("FilterListId") + .OnDelete(DeleteBehavior.Cascade); - b.HasOne("FilterLists.Data.Entities.Language", "Language") - .WithMany("FilterListLanguages") - .HasForeignKey("LanguageId") - .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.FilterList", "FilterList") + .WithMany("FilterListMaintainers") + .HasForeignKey("FilterListId") + .OnDelete(DeleteBehavior.Cascade); - b.HasOne("FilterLists.Data.Entities.Maintainer", "Maintainer") - .WithMany("FilterListMaintainers") - .HasForeignKey("MaintainerId") - .OnDelete(DeleteBehavior.Cascade); - }); + b.HasOne("FilterLists.Data.Entities.Maintainer", "Maintainer") + .WithMany("FilterListMaintainers") + .HasForeignKey("MaintainerId") + .OnDelete(DeleteBehavior.Cascade); + }); modelBuilder.Entity("FilterLists.Data.Entities.Junctions.FilterListRule", b => - { - b.HasOne("FilterLists.Data.Entities.FilterList", "FilterList") - .WithMany("FilterListRules") - .HasForeignKey("FilterListId") - .OnDelete(DeleteBehavior.Cascade); + { + b.HasOne("FilterLists.Data.Entities.FilterList", "FilterList") + .WithMany("FilterListRules") + .HasForeignKey("FilterListId") + .OnDelete(DeleteBehavior.Cascade); - b.HasOne("FilterLists.Data.Entities.Rule", "Rule") - .WithMany("FilterListRules") - .HasForeignKey("RuleId") - .OnDelete(DeleteBehavior.Cascade); - }); + b.HasOne("FilterLists.Data.Entities.Rule", "Rule") + .WithMany("FilterListRules") + .HasForeignKey("RuleId") + .OnDelete(DeleteBehavior.Cascade); + }); modelBuilder.Entity("FilterLists.Data.Entities.Junctions.Fork", b => - { - b.HasOne("FilterLists.Data.Entities.FilterList", "ForkFilterList") - .WithMany() - .HasForeignKey("ForkFilterListId") - .OnDelete(DeleteBehavior.Cascade); + { + b.HasOne("FilterLists.Data.Entities.FilterList", "ForkFilterList") + .WithMany() + .HasForeignKey("ForkFilterListId") + .OnDelete(DeleteBehavior.Cascade); - b.HasOne("FilterLists.Data.Entities.FilterList", "UpstreamFilterList") - .WithMany() - .HasForeignKey("UpstreamFilterListId") - .OnDelete(DeleteBehavior.Cascade); - }); + b.HasOne("FilterLists.Data.Entities.FilterList", "UpstreamFilterList") + .WithMany() + .HasForeignKey("UpstreamFilterListId") + .OnDelete(DeleteBehavior.Cascade); + }); modelBuilder.Entity("FilterLists.Data.Entities.Junctions.Merge", b => - { - b.HasOne("FilterLists.Data.Entities.FilterList", "MergeFilterList") - .WithMany() - .HasForeignKey("MergeFilterListId") - .OnDelete(DeleteBehavior.Cascade); + { + b.HasOne("FilterLists.Data.Entities.FilterList", "MergeFilterList") + .WithMany() + .HasForeignKey("MergeFilterListId") + .OnDelete(DeleteBehavior.Cascade); - b.HasOne("FilterLists.Data.Entities.FilterList", "UpstreamFilterList") - .WithMany() - .HasForeignKey("UpstreamFilterListId") - .OnDelete(DeleteBehavior.Cascade); - }); + b.HasOne("FilterLists.Data.Entities.FilterList", "UpstreamFilterList") + .WithMany() + .HasForeignKey("UpstreamFilterListId") + .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.Software", "Software") + .WithMany("SoftwareSyntaxes") + .HasForeignKey("SoftwareId") + .OnDelete(DeleteBehavior.Cascade); - b.HasOne("FilterLists.Data.Entities.Syntax", "Syntax") - .WithMany("SoftwareSyntaxes") - .HasForeignKey("SyntaxId") - .OnDelete(DeleteBehavior.Cascade); - }); + b.HasOne("FilterLists.Data.Entities.Syntax", "Syntax") + .WithMany("SoftwareSyntaxes") + .HasForeignKey("SyntaxId") + .OnDelete(DeleteBehavior.Cascade); + }); #pragma warning restore 612, 618 } } -} +} \ No newline at end of file diff --git a/src/FilterLists.Data/EntityTypeConfigurations/FilterListTypeConfiguration.cs b/src/FilterLists.Data/EntityTypeConfigurations/FilterListTypeConfiguration.cs index 4a68b0c72..a7896178f 100644 --- a/src/FilterLists.Data/EntityTypeConfigurations/FilterListTypeConfiguration.cs +++ b/src/FilterLists.Data/EntityTypeConfigurations/FilterListTypeConfiguration.cs @@ -13,9 +13,11 @@ public void Configure(EntityTypeBuilder entityTypeBuilder) entityTypeBuilder.Property(x => x.Id) .HasColumnType("SMALLINT UNSIGNED"); entityTypeBuilder.Property(x => x.CreatedDateUtc) - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP"); + .HasColumnType("TIMESTAMP") + .ValueGeneratedOnAdd(); entityTypeBuilder.Property(x => x.ModifiedDateUtc) - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"); + .HasColumnType("TIMESTAMP") + .ValueGeneratedOnAddOrUpdate(); entityTypeBuilder.Property(x => x.Description) .HasColumnType("TEXT"); diff --git a/src/FilterLists.Data/EntityTypeConfigurations/Junctions/FilterListLanguageTypeConfiguration.cs b/src/FilterLists.Data/EntityTypeConfigurations/Junctions/FilterListLanguageTypeConfiguration.cs index 5dfeb125c..58a76ce69 100644 --- a/src/FilterLists.Data/EntityTypeConfigurations/Junctions/FilterListLanguageTypeConfiguration.cs +++ b/src/FilterLists.Data/EntityTypeConfigurations/Junctions/FilterListLanguageTypeConfiguration.cs @@ -11,7 +11,8 @@ public void Configure(EntityTypeBuilder entityTypeBuilder) entityTypeBuilder.ToTable("filterlists_languages"); entityTypeBuilder.HasKey(x => new {x.FilterListId, x.LanguageId}); entityTypeBuilder.Property(x => x.CreatedDateUtc) - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP"); + .HasColumnType("TIMESTAMP") + .ValueGeneratedOnAdd(); } } } \ No newline at end of file diff --git a/src/FilterLists.Data/EntityTypeConfigurations/Junctions/FilterListMaintainerTypeConfiguration.cs b/src/FilterLists.Data/EntityTypeConfigurations/Junctions/FilterListMaintainerTypeConfiguration.cs index a9bb26b2d..fe224a4c0 100644 --- a/src/FilterLists.Data/EntityTypeConfigurations/Junctions/FilterListMaintainerTypeConfiguration.cs +++ b/src/FilterLists.Data/EntityTypeConfigurations/Junctions/FilterListMaintainerTypeConfiguration.cs @@ -11,7 +11,8 @@ public void Configure(EntityTypeBuilder entityTypeBuilder) entityTypeBuilder.ToTable("filterlists_maintainers"); entityTypeBuilder.HasKey(x => new {x.FilterListId, x.MaintainerId}); entityTypeBuilder.Property(x => x.CreatedDateUtc) - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP"); + .HasColumnType("TIMESTAMP") + .ValueGeneratedOnAdd(); } } } \ No newline at end of file diff --git a/src/FilterLists.Data/EntityTypeConfigurations/Junctions/FilterListRuleTypeConfiguration.cs b/src/FilterLists.Data/EntityTypeConfigurations/Junctions/FilterListRuleTypeConfiguration.cs index 1ed2ad5bc..dbe85a5bd 100644 --- a/src/FilterLists.Data/EntityTypeConfigurations/Junctions/FilterListRuleTypeConfiguration.cs +++ b/src/FilterLists.Data/EntityTypeConfigurations/Junctions/FilterListRuleTypeConfiguration.cs @@ -11,7 +11,8 @@ public void Configure(EntityTypeBuilder entityTypeBuilder) entityTypeBuilder.ToTable("filterlists_rules"); entityTypeBuilder.HasKey(x => new {x.FilterListId, x.RuleId}); entityTypeBuilder.Property(x => x.CreatedDateUtc) - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP"); + .HasColumnType("TIMESTAMP") + .ValueGeneratedOnAdd(); } } } \ No newline at end of file diff --git a/src/FilterLists.Data/EntityTypeConfigurations/Junctions/ForkTypeConfiguration.cs b/src/FilterLists.Data/EntityTypeConfigurations/Junctions/ForkTypeConfiguration.cs index 5871f94dd..c95724996 100644 --- a/src/FilterLists.Data/EntityTypeConfigurations/Junctions/ForkTypeConfiguration.cs +++ b/src/FilterLists.Data/EntityTypeConfigurations/Junctions/ForkTypeConfiguration.cs @@ -11,7 +11,8 @@ public void Configure(EntityTypeBuilder entityTypeBuilder) entityTypeBuilder.ToTable("forks"); entityTypeBuilder.HasKey(x => new {x.ForkFilterListId, x.UpstreamFilterListId}); entityTypeBuilder.Property(x => x.CreatedDateUtc) - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP"); + .HasColumnType("TIMESTAMP") + .ValueGeneratedOnAdd(); } } } \ No newline at end of file diff --git a/src/FilterLists.Data/EntityTypeConfigurations/Junctions/MergeTypeConfiguration.cs b/src/FilterLists.Data/EntityTypeConfigurations/Junctions/MergeTypeConfiguration.cs index f3f052f03..6ba74d369 100644 --- a/src/FilterLists.Data/EntityTypeConfigurations/Junctions/MergeTypeConfiguration.cs +++ b/src/FilterLists.Data/EntityTypeConfigurations/Junctions/MergeTypeConfiguration.cs @@ -11,7 +11,8 @@ public void Configure(EntityTypeBuilder entityTypeBuilder) entityTypeBuilder.ToTable("merges"); entityTypeBuilder.HasKey(x => new {x.MergeFilterListId, x.UpstreamFilterListId}); entityTypeBuilder.Property(x => x.CreatedDateUtc) - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP"); + .HasColumnType("TIMESTAMP") + .ValueGeneratedOnAdd(); } } } \ No newline at end of file diff --git a/src/FilterLists.Data/EntityTypeConfigurations/Junctions/SoftwareSyntaxTypeConfiguration.cs b/src/FilterLists.Data/EntityTypeConfigurations/Junctions/SoftwareSyntaxTypeConfiguration.cs index 425a8597f..017745acf 100644 --- a/src/FilterLists.Data/EntityTypeConfigurations/Junctions/SoftwareSyntaxTypeConfiguration.cs +++ b/src/FilterLists.Data/EntityTypeConfigurations/Junctions/SoftwareSyntaxTypeConfiguration.cs @@ -11,7 +11,8 @@ public void Configure(EntityTypeBuilder entityTypeBuilder) entityTypeBuilder.ToTable("software_syntaxes"); entityTypeBuilder.HasKey(x => new {x.SoftwareId, x.SyntaxId}); entityTypeBuilder.Property(x => x.CreatedDateUtc) - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP"); + .HasColumnType("TIMESTAMP") + .ValueGeneratedOnAdd(); } } } \ No newline at end of file diff --git a/src/FilterLists.Data/EntityTypeConfigurations/LanguageTypeConfiguration.cs b/src/FilterLists.Data/EntityTypeConfigurations/LanguageTypeConfiguration.cs index 77d40eac1..b149c042d 100644 --- a/src/FilterLists.Data/EntityTypeConfigurations/LanguageTypeConfiguration.cs +++ b/src/FilterLists.Data/EntityTypeConfigurations/LanguageTypeConfiguration.cs @@ -13,9 +13,11 @@ public void Configure(EntityTypeBuilder entityTypeBuilder) entityTypeBuilder.Property(x => x.Id) .HasColumnType("SMALLINT UNSIGNED"); entityTypeBuilder.Property(x => x.CreatedDateUtc) - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP"); + .HasColumnType("TIMESTAMP") + .ValueGeneratedOnAdd(); entityTypeBuilder.Property(x => x.ModifiedDateUtc) - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"); + .HasColumnType("TIMESTAMP") + .ValueGeneratedOnAddOrUpdate(); entityTypeBuilder.Property(x => x.Iso6391) .HasColumnType("NVARCHAR(2)"); diff --git a/src/FilterLists.Data/EntityTypeConfigurations/LicenseTypeConfiguration.cs b/src/FilterLists.Data/EntityTypeConfigurations/LicenseTypeConfiguration.cs index 5c794086e..cdbbb3ae3 100644 --- a/src/FilterLists.Data/EntityTypeConfigurations/LicenseTypeConfiguration.cs +++ b/src/FilterLists.Data/EntityTypeConfigurations/LicenseTypeConfiguration.cs @@ -13,9 +13,11 @@ public void Configure(EntityTypeBuilder entityTypeBuilder) entityTypeBuilder.Property(x => x.Id) .HasColumnType("SMALLINT UNSIGNED"); entityTypeBuilder.Property(x => x.CreatedDateUtc) - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP"); + .HasColumnType("TIMESTAMP") + .ValueGeneratedOnAdd(); entityTypeBuilder.Property(x => x.ModifiedDateUtc) - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"); + .HasColumnType("TIMESTAMP") + .ValueGeneratedOnAddOrUpdate(); entityTypeBuilder.Property(x => x.DescriptionUrl) .HasColumnType("TEXT"); diff --git a/src/FilterLists.Data/EntityTypeConfigurations/MaintainerTypeConfiguration.cs b/src/FilterLists.Data/EntityTypeConfigurations/MaintainerTypeConfiguration.cs index 12f88836e..35f2c4a24 100644 --- a/src/FilterLists.Data/EntityTypeConfigurations/MaintainerTypeConfiguration.cs +++ b/src/FilterLists.Data/EntityTypeConfigurations/MaintainerTypeConfiguration.cs @@ -13,9 +13,11 @@ public void Configure(EntityTypeBuilder entityTypeBuilder) entityTypeBuilder.Property(x => x.Id) .HasColumnType("SMALLINT UNSIGNED"); entityTypeBuilder.Property(x => x.CreatedDateUtc) - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP"); + .HasColumnType("TIMESTAMP") + .ValueGeneratedOnAdd(); entityTypeBuilder.Property(x => x.ModifiedDateUtc) - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"); + .HasColumnType("TIMESTAMP") + .ValueGeneratedOnAddOrUpdate(); entityTypeBuilder.Property(x => x.EmailAddress) .HasColumnType("NVARCHAR(126)"); diff --git a/src/FilterLists.Data/EntityTypeConfigurations/RuleTypeConfiguration.cs b/src/FilterLists.Data/EntityTypeConfigurations/RuleTypeConfiguration.cs index 733c800e9..9d80b1a52 100644 --- a/src/FilterLists.Data/EntityTypeConfigurations/RuleTypeConfiguration.cs +++ b/src/FilterLists.Data/EntityTypeConfigurations/RuleTypeConfiguration.cs @@ -13,7 +13,8 @@ public void Configure(EntityTypeBuilder entityTypeBuilder) entityTypeBuilder.Property(x => x.Id) .HasColumnType("BIGINT UNSIGNED"); entityTypeBuilder.Property(x => x.CreatedDateUtc) - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP"); + .HasColumnType("TIMESTAMP") + .ValueGeneratedOnAdd(); entityTypeBuilder.Property(x => x.Raw) .HasColumnType("NVARCHAR(2083) NOT NULL"); diff --git a/src/FilterLists.Data/EntityTypeConfigurations/SoftwareTypeConfiguration.cs b/src/FilterLists.Data/EntityTypeConfigurations/SoftwareTypeConfiguration.cs index 893b5312d..fc07b2dd5 100644 --- a/src/FilterLists.Data/EntityTypeConfigurations/SoftwareTypeConfiguration.cs +++ b/src/FilterLists.Data/EntityTypeConfigurations/SoftwareTypeConfiguration.cs @@ -13,9 +13,11 @@ public void Configure(EntityTypeBuilder entityTypeBuilder) entityTypeBuilder.Property(x => x.Id) .HasColumnType("SMALLINT UNSIGNED"); entityTypeBuilder.Property(x => x.CreatedDateUtc) - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP"); + .HasColumnType("TIMESTAMP") + .ValueGeneratedOnAdd(); entityTypeBuilder.Property(x => x.ModifiedDateUtc) - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"); + .HasColumnType("TIMESTAMP") + .ValueGeneratedOnAddOrUpdate(); entityTypeBuilder.Property(x => x.DownloadUrl) .HasColumnType("TEXT"); diff --git a/src/FilterLists.Data/EntityTypeConfigurations/SyntaxTypeConfiguration.cs b/src/FilterLists.Data/EntityTypeConfigurations/SyntaxTypeConfiguration.cs index bfd9ed45d..2e76c03d2 100644 --- a/src/FilterLists.Data/EntityTypeConfigurations/SyntaxTypeConfiguration.cs +++ b/src/FilterLists.Data/EntityTypeConfigurations/SyntaxTypeConfiguration.cs @@ -13,10 +13,12 @@ public void Configure(EntityTypeBuilder entityTypeBuilder) entityTypeBuilder.Property(x => x.Id) .HasColumnType("SMALLINT UNSIGNED"); entityTypeBuilder.Property(x => x.CreatedDateUtc) - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP"); + .HasColumnType("TIMESTAMP") + .ValueGeneratedOnAdd(); entityTypeBuilder.Property(x => x.ModifiedDateUtc) - .HasColumnType("TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"); - + .HasColumnType("TIMESTAMP") + .ValueGeneratedOnAddOrUpdate(); + entityTypeBuilder.Property(x => x.DefinitionUrl) .HasColumnType("TEXT"); entityTypeBuilder.Property(x => x.Name)