diff --git a/src/FilterLists.Api/Migrations/20171104020037_add DiscontinuedDate to FilterList.Designer.cs b/src/FilterLists.Api/Migrations/20171104020037_add DiscontinuedDate to FilterList.Designer.cs new file mode 100644 index 000000000..8d06f79e6 --- /dev/null +++ b/src/FilterLists.Api/Migrations/20171104020037_add DiscontinuedDate to FilterList.Designer.cs @@ -0,0 +1,413 @@ +// +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))] + [Migration("20171104020037_add DiscontinuedDate to FilterList")] + partial class addDiscontinuedDatetoFilterList + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn) + .HasAnnotation("ProductVersion", "2.0.0-rtm-26452"); + + modelBuilder.Entity("FilterLists.Data.Entities.FilterList", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("CreatedDateUtc") + .ValueGeneratedOnAdd() + .HasColumnType("TIMESTAMP"); + + b.Property("Description") + .HasMaxLength(4096); + + b.Property("DescriptionSourceUrl") + .HasMaxLength(2083); + + b.Property("DiscontinuedDate"); + + b.Property("DonateUrl") + .HasMaxLength(2083); + + b.Property("EmailAddress") + .HasMaxLength(126); + + b.Property("ForumUrl") + .HasMaxLength(2083); + + b.Property("HomeUrl") + .HasMaxLength(2083); + + b.Property("IssuesUrl") + .HasMaxLength(2083); + + b.Property("LicenseId"); + + b.Property("MaintainerId"); + + b.Property("ModifiedDateUtc") + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("TIMESTAMP"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(126); + + b.Property("SubmissionUrl") + .HasMaxLength(2083); + + b.Property("ViewUrl") + .HasMaxLength(2083); + + b.HasKey("Id"); + + b.HasIndex("LicenseId"); + + b.HasIndex("MaintainerId"); + + b.ToTable("filterlists"); + }); + + modelBuilder.Entity("FilterLists.Data.Entities.FilterListLanguage", b => + { + b.Property("FilterListId"); + + b.Property("LanguageId"); + + b.Property("CreatedDateUtc") + .ValueGeneratedOnAdd() + .HasColumnType("TIMESTAMP"); + + b.Property("ModifiedDateUtc") + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("TIMESTAMP"); + + b.HasKey("FilterListId", "LanguageId"); + + b.HasIndex("LanguageId"); + + b.ToTable("filterlists_languages"); + }); + + modelBuilder.Entity("FilterLists.Data.Entities.FilterListRule", b => + { + b.Property("FilterListId"); + + b.Property("RuleId"); + + b.Property("CreatedDateUtc") + .ValueGeneratedOnAdd() + .HasColumnType("TIMESTAMP"); + + b.Property("ModifiedDateUtc") + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("TIMESTAMP"); + + b.HasKey("FilterListId", "RuleId"); + + b.HasIndex("RuleId"); + + b.ToTable("filterlists_rules"); + }); + + modelBuilder.Entity("FilterLists.Data.Entities.FilterListSoftware", b => + { + b.Property("FilterListId"); + + b.Property("SoftwareId"); + + b.Property("CreatedDateUtc") + .ValueGeneratedOnAdd() + .HasColumnType("TIMESTAMP"); + + b.Property("ModifiedDateUtc") + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("TIMESTAMP"); + + b.HasKey("FilterListId", "SoftwareId"); + + b.HasIndex("SoftwareId"); + + b.ToTable("filterlists_software"); + }); + + modelBuilder.Entity("FilterLists.Data.Entities.Fork", b => + { + b.Property("ForkFilterListId"); + + b.Property("UpstreamFilterListId"); + + b.Property("CreatedDateUtc") + .ValueGeneratedOnAdd() + .HasColumnType("TIMESTAMP"); + + b.Property("ModifiedDateUtc") + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("TIMESTAMP"); + + b.HasKey("ForkFilterListId", "UpstreamFilterListId"); + + b.HasIndex("UpstreamFilterListId"); + + b.ToTable("forks"); + }); + + modelBuilder.Entity("FilterLists.Data.Entities.Language", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("CreatedDateUtc") + .ValueGeneratedOnAdd() + .HasColumnType("TIMESTAMP"); + + b.Property("Iso6391") + .HasMaxLength(2); + + b.Property("Iso6392") + .HasMaxLength(3); + + b.Property("Iso6392B") + .HasMaxLength(3); + + b.Property("Iso6392T") + .HasMaxLength(3); + + b.Property("Iso6393") + .HasMaxLength(3); + + b.Property("LocalName") + .HasMaxLength(126); + + b.Property("ModifiedDateUtc") + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("TIMESTAMP"); + + b.Property("Name") + .HasMaxLength(126); + + b.HasKey("Id"); + + b.ToTable("languages"); + }); + + modelBuilder.Entity("FilterLists.Data.Entities.License", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("CreatedDateUtc") + .ValueGeneratedOnAdd() + .HasColumnType("TIMESTAMP"); + + b.Property("DescriptionUrl") + .HasMaxLength(2083); + + b.Property("ModifiedDateUtc") + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("TIMESTAMP"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(126); + + b.Property("PermissiveAdaptation"); + + b.Property("PermissiveCommercial"); + + b.HasKey("Id"); + + b.ToTable("licenses"); + }); + + modelBuilder.Entity("FilterLists.Data.Entities.Maintainer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("CreatedDateUtc") + .ValueGeneratedOnAdd() + .HasColumnType("TIMESTAMP"); + + b.Property("EmailAddress") + .HasMaxLength(126); + + b.Property("HomeUrl") + .HasMaxLength(2083); + + b.Property("ModifiedDateUtc") + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("TIMESTAMP"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(126); + + b.Property("TwitterHandle") + .HasMaxLength(126); + + b.HasKey("Id"); + + b.ToTable("maintainers"); + }); + + modelBuilder.Entity("FilterLists.Data.Entities.Merge", b => + { + b.Property("MergeFilterListId"); + + b.Property("UpstreamFilterListId"); + + b.Property("CreatedDateUtc") + .ValueGeneratedOnAdd() + .HasColumnType("TIMESTAMP"); + + b.Property("ModifiedDateUtc") + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("TIMESTAMP"); + + b.HasKey("MergeFilterListId", "UpstreamFilterListId"); + + b.HasIndex("UpstreamFilterListId"); + + b.ToTable("merges"); + }); + + modelBuilder.Entity("FilterLists.Data.Entities.Rule", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("CreatedDateUtc") + .ValueGeneratedOnAdd() + .HasColumnType("TIMESTAMP"); + + b.Property("ModifiedDateUtc") + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("TIMESTAMP"); + + b.Property("Raw") + .HasMaxLength(2083); + + b.HasKey("Id"); + + b.ToTable("rules"); + }); + + modelBuilder.Entity("FilterLists.Data.Entities.Software", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("CreatedDateUtc") + .ValueGeneratedOnAdd() + .HasColumnType("TIMESTAMP"); + + b.Property("DownloadUrl") + .HasMaxLength(2083); + + b.Property("HomeUrl") + .HasMaxLength(2083); + + b.Property("ModifiedDateUtc") + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("TIMESTAMP"); + + b.Property("Name") + .HasMaxLength(126); + + b.HasKey("Id"); + + b.ToTable("software"); + }); + + modelBuilder.Entity("FilterLists.Data.Entities.FilterList", b => + { + b.HasOne("FilterLists.Data.Entities.License") + .WithMany("FilterLists") + .HasForeignKey("LicenseId"); + + b.HasOne("FilterLists.Data.Entities.Maintainer") + .WithMany("FilterLists") + .HasForeignKey("MaintainerId"); + }); + + modelBuilder.Entity("FilterLists.Data.Entities.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.FilterListRule", b => + { + 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); + }); + + modelBuilder.Entity("FilterLists.Data.Entities.FilterListSoftware", b => + { + b.HasOne("FilterLists.Data.Entities.FilterList", "FilterList") + .WithMany("FilterListSoftware") + .HasForeignKey("FilterListId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("FilterLists.Data.Entities.Software", "Software") + .WithMany("FilterListSoftware") + .HasForeignKey("SoftwareId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("FilterLists.Data.Entities.Fork", b => + { + 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); + }); + + modelBuilder.Entity("FilterLists.Data.Entities.Merge", b => + { + 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); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/FilterLists.Api/Migrations/20171104020037_add DiscontinuedDate to FilterList.cs b/src/FilterLists.Api/Migrations/20171104020037_add DiscontinuedDate to FilterList.cs new file mode 100644 index 000000000..307a6fdbe --- /dev/null +++ b/src/FilterLists.Api/Migrations/20171104020037_add DiscontinuedDate to FilterList.cs @@ -0,0 +1,25 @@ +using Microsoft.EntityFrameworkCore.Migrations; +using System; +using System.Collections.Generic; + +namespace FilterLists.Api.Migrations +{ + public partial class addDiscontinuedDatetoFilterList : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "DiscontinuedDate", + table: "filterlists", + type: "datetime(6)", + nullable: true); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "DiscontinuedDate", + table: "filterlists"); + } + } +} diff --git a/src/FilterLists.Api/Migrations/FilterListsDbContextModelSnapshot.cs b/src/FilterLists.Api/Migrations/FilterListsDbContextModelSnapshot.cs index b4bd0c0b0..60abb94c9 100644 --- a/src/FilterLists.Api/Migrations/FilterListsDbContextModelSnapshot.cs +++ b/src/FilterLists.Api/Migrations/FilterListsDbContextModelSnapshot.cs @@ -35,6 +35,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("DescriptionSourceUrl") .HasMaxLength(2083); + b.Property("DiscontinuedDate"); + b.Property("DonateUrl") .HasMaxLength(2083); diff --git a/src/FilterLists.Data/Entities/FilterList.cs b/src/FilterLists.Data/Entities/FilterList.cs index c0f9e97df..7b6e7ee72 100644 --- a/src/FilterLists.Data/Entities/FilterList.cs +++ b/src/FilterLists.Data/Entities/FilterList.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; namespace FilterLists.Data.Entities { @@ -6,6 +7,7 @@ public class FilterList : BaseEntity { public string Description { get; set; } public string DescriptionSourceUrl { get; set; } + public DateTime? DiscontinuedDate { get; set; } public string DonateUrl { get; set; } public string EmailAddress { get; set; } public string ForumUrl { get; set; } diff --git a/src/FilterLists.Data/EntityTypeConfigurations/BaseEntityConfiguration.cs b/src/FilterLists.Data/EntityTypeConfigurations/BaseEntityConfiguration.cs index 48b6086a5..5e469454f 100644 --- a/src/FilterLists.Data/EntityTypeConfigurations/BaseEntityConfiguration.cs +++ b/src/FilterLists.Data/EntityTypeConfigurations/BaseEntityConfiguration.cs @@ -8,10 +8,10 @@ public class BaseEntityTypeConfiguration : IEntityTypeConfiguration entityTypeBuilder) { - entityTypeBuilder.Property(b => b.CreatedDateUtc) + entityTypeBuilder.Property(x => x.CreatedDateUtc) .HasColumnType("TIMESTAMP") .ValueGeneratedOnAdd(); - entityTypeBuilder.Property(b => b.ModifiedDateUtc) + entityTypeBuilder.Property(x => x.ModifiedDateUtc) .HasColumnType("TIMESTAMP") .ValueGeneratedOnAddOrUpdate(); } diff --git a/src/FilterLists.Data/EntityTypeConfigurations/FilterListTypeConfiguration.cs b/src/FilterLists.Data/EntityTypeConfigurations/FilterListTypeConfiguration.cs index ba1fa7bea..f1dba6bcc 100644 --- a/src/FilterLists.Data/EntityTypeConfigurations/FilterListTypeConfiguration.cs +++ b/src/FilterLists.Data/EntityTypeConfigurations/FilterListTypeConfiguration.cs @@ -9,26 +9,26 @@ public class FilterListTypeConfiguration : BaseEntityTypeConfiguration entityTypeBuilder) { entityTypeBuilder.ToTable("filterlists"); - entityTypeBuilder.Property(b => b.Description) + entityTypeBuilder.Property(x => x.Description) .HasMaxLength(4096); - entityTypeBuilder.Property(b => b.DescriptionSourceUrl) + entityTypeBuilder.Property(x => x.DescriptionSourceUrl) .HasMaxLength(2083); - entityTypeBuilder.Property(b => b.DonateUrl) + entityTypeBuilder.Property(x => x.DonateUrl) .HasMaxLength(2083); - entityTypeBuilder.Property(b => b.EmailAddress) + entityTypeBuilder.Property(x => x.EmailAddress) .HasMaxLength(126); - entityTypeBuilder.Property(b => b.ForumUrl) + entityTypeBuilder.Property(x => x.ForumUrl) .HasMaxLength(2083); - entityTypeBuilder.Property(b => b.HomeUrl) + entityTypeBuilder.Property(x => x.HomeUrl) .HasMaxLength(2083); - entityTypeBuilder.Property(b => b.IssuesUrl) + entityTypeBuilder.Property(x => x.IssuesUrl) .HasMaxLength(2083); - entityTypeBuilder.Property(b => b.Name) + entityTypeBuilder.Property(x => x.Name) .IsRequired() .HasMaxLength(126); - entityTypeBuilder.Property(b => b.SubmissionUrl) + entityTypeBuilder.Property(x => x.SubmissionUrl) .HasMaxLength(2083); - entityTypeBuilder.Property(b => b.ViewUrl) + entityTypeBuilder.Property(x => x.ViewUrl) .HasMaxLength(2083); base.Configure(entityTypeBuilder); } diff --git a/src/FilterLists.Data/EntityTypeConfigurations/LanguageTypeConfiguration.cs b/src/FilterLists.Data/EntityTypeConfigurations/LanguageTypeConfiguration.cs index 58283b607..a9f04d449 100644 --- a/src/FilterLists.Data/EntityTypeConfigurations/LanguageTypeConfiguration.cs +++ b/src/FilterLists.Data/EntityTypeConfigurations/LanguageTypeConfiguration.cs @@ -9,19 +9,19 @@ public class LanguageTypeConfiguration : BaseEntityTypeConfiguration public override void Configure(EntityTypeBuilder entityTypeBuilder) { entityTypeBuilder.ToTable("languages"); - entityTypeBuilder.Property(b => b.Iso6391) + entityTypeBuilder.Property(x => x.Iso6391) .HasMaxLength(2); - entityTypeBuilder.Property(b => b.Iso6392) + entityTypeBuilder.Property(x => x.Iso6392) .HasMaxLength(3); - entityTypeBuilder.Property(b => b.Iso6392B) + entityTypeBuilder.Property(x => x.Iso6392B) .HasMaxLength(3); - entityTypeBuilder.Property(b => b.Iso6392T) + entityTypeBuilder.Property(x => x.Iso6392T) .HasMaxLength(3); - entityTypeBuilder.Property(b => b.Iso6393) + entityTypeBuilder.Property(x => x.Iso6393) .HasMaxLength(3); - entityTypeBuilder.Property(b => b.LocalName) + entityTypeBuilder.Property(x => x.LocalName) .HasMaxLength(126); - entityTypeBuilder.Property(b => b.Name) + entityTypeBuilder.Property(x => x.Name) .HasMaxLength(126); base.Configure(entityTypeBuilder); } diff --git a/src/FilterLists.Data/EntityTypeConfigurations/LicenseTypeConfiguration.cs b/src/FilterLists.Data/EntityTypeConfigurations/LicenseTypeConfiguration.cs index b089bdd1d..51b8ff93e 100644 --- a/src/FilterLists.Data/EntityTypeConfigurations/LicenseTypeConfiguration.cs +++ b/src/FilterLists.Data/EntityTypeConfigurations/LicenseTypeConfiguration.cs @@ -9,9 +9,9 @@ public class LicenseTypeConfiguration : BaseEntityTypeConfiguration public override void Configure(EntityTypeBuilder entityTypeBuilder) { entityTypeBuilder.ToTable("licenses"); - entityTypeBuilder.Property(b => b.DescriptionUrl) + entityTypeBuilder.Property(x => x.DescriptionUrl) .HasMaxLength(2083); - entityTypeBuilder.Property(b => b.Name) + entityTypeBuilder.Property(x => x.Name) .IsRequired() .HasMaxLength(126); base.Configure(entityTypeBuilder); diff --git a/src/FilterLists.Data/EntityTypeConfigurations/MaintainerTypeConfiguration.cs b/src/FilterLists.Data/EntityTypeConfigurations/MaintainerTypeConfiguration.cs index 19ac7c4e8..e1877f808 100644 --- a/src/FilterLists.Data/EntityTypeConfigurations/MaintainerTypeConfiguration.cs +++ b/src/FilterLists.Data/EntityTypeConfigurations/MaintainerTypeConfiguration.cs @@ -9,14 +9,14 @@ public class MaintainerTypeConfiguration : BaseEntityTypeConfiguration entityTypeBuilder) { entityTypeBuilder.ToTable("maintainers"); - entityTypeBuilder.Property(b => b.EmailAddress) + entityTypeBuilder.Property(x => x.EmailAddress) .HasMaxLength(126); - entityTypeBuilder.Property(b => b.HomeUrl) + entityTypeBuilder.Property(x => x.HomeUrl) .HasMaxLength(2083); - entityTypeBuilder.Property(b => b.Name) + entityTypeBuilder.Property(x => x.Name) .IsRequired() .HasMaxLength(126); - entityTypeBuilder.Property(b => b.TwitterHandle) + entityTypeBuilder.Property(x => x.TwitterHandle) .HasMaxLength(126); base.Configure(entityTypeBuilder); } diff --git a/src/FilterLists.Data/EntityTypeConfigurations/RuleTypeConfiguration.cs b/src/FilterLists.Data/EntityTypeConfigurations/RuleTypeConfiguration.cs index 088fbc3d6..701d8200d 100644 --- a/src/FilterLists.Data/EntityTypeConfigurations/RuleTypeConfiguration.cs +++ b/src/FilterLists.Data/EntityTypeConfigurations/RuleTypeConfiguration.cs @@ -9,7 +9,7 @@ public class RuleTypeConfiguration : BaseEntityTypeConfiguration public override void Configure(EntityTypeBuilder entityTypeBuilder) { entityTypeBuilder.ToTable("rules"); - entityTypeBuilder.Property(b => b.Raw) + entityTypeBuilder.Property(x => x.Raw) .HasMaxLength(2083); base.Configure(entityTypeBuilder); } diff --git a/src/FilterLists.Data/EntityTypeConfigurations/SoftwareTypeConfiguration.cs b/src/FilterLists.Data/EntityTypeConfigurations/SoftwareTypeConfiguration.cs index d6aadb41e..9bce21379 100644 --- a/src/FilterLists.Data/EntityTypeConfigurations/SoftwareTypeConfiguration.cs +++ b/src/FilterLists.Data/EntityTypeConfigurations/SoftwareTypeConfiguration.cs @@ -9,11 +9,11 @@ public class SoftwareTypeConfiguration : BaseEntityTypeConfiguration public override void Configure(EntityTypeBuilder entityTypeBuilder) { entityTypeBuilder.ToTable("software"); - entityTypeBuilder.Property(b => b.DownloadUrl) + entityTypeBuilder.Property(x => x.DownloadUrl) .HasMaxLength(2083); - entityTypeBuilder.Property(b => b.HomeUrl) + entityTypeBuilder.Property(x => x.HomeUrl) .HasMaxLength(2083); - entityTypeBuilder.Property(b => b.Name) + entityTypeBuilder.Property(x => x.Name) .HasMaxLength(126); base.Configure(entityTypeBuilder); }