mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
parent
62f4a34df4
commit
1dd1e1dee3
7 changed files with 482 additions and 0 deletions
340
src/FilterLists.Api/Migrations/20171101011709_add License.Designer.cs
generated
Normal file
340
src/FilterLists.Api/Migrations/20171101011709_add License.Designer.cs
generated
Normal file
|
|
@ -0,0 +1,340 @@
|
|||
// <auto-generated />
|
||||
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("20171101011709_add License")]
|
||||
partial class addLicense
|
||||
{
|
||||
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<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<DateTime>("CreatedDateUtc")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("TIMESTAMP");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasMaxLength(4096);
|
||||
|
||||
b.Property<string>("DescriptionSourceUrl")
|
||||
.HasMaxLength(2083);
|
||||
|
||||
b.Property<string>("DonateUrl")
|
||||
.HasMaxLength(2083);
|
||||
|
||||
b.Property<string>("EmailAddress")
|
||||
.HasMaxLength(126);
|
||||
|
||||
b.Property<string>("ForumUrl")
|
||||
.HasMaxLength(2083);
|
||||
|
||||
b.Property<string>("HomeUrl")
|
||||
.HasMaxLength(2083);
|
||||
|
||||
b.Property<string>("IssuesUrl")
|
||||
.HasMaxLength(2083);
|
||||
|
||||
b.Property<int?>("LicenseId");
|
||||
|
||||
b.Property<int?>("MaintainerId");
|
||||
|
||||
b.Property<DateTime>("ModifiedDateUtc")
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("TIMESTAMP");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(126);
|
||||
|
||||
b.Property<string>("ViewUrl")
|
||||
.HasMaxLength(2083);
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("LicenseId");
|
||||
|
||||
b.HasIndex("MaintainerId");
|
||||
|
||||
b.ToTable("filterlists");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FilterLists.Data.Entities.FilterListLanguage", b =>
|
||||
{
|
||||
b.Property<int>("FilterListId");
|
||||
|
||||
b.Property<int>("LanguageId");
|
||||
|
||||
b.Property<DateTime>("CreatedDateUtc")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("TIMESTAMP");
|
||||
|
||||
b.Property<DateTime>("ModifiedDateUtc")
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("TIMESTAMP");
|
||||
|
||||
b.HasKey("FilterListId", "LanguageId");
|
||||
|
||||
b.HasIndex("LanguageId");
|
||||
|
||||
b.ToTable("filterlists_languages");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FilterLists.Data.Entities.FilterListRule", b =>
|
||||
{
|
||||
b.Property<int>("FilterListId");
|
||||
|
||||
b.Property<int>("RuleId");
|
||||
|
||||
b.Property<DateTime>("CreatedDateUtc")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("TIMESTAMP");
|
||||
|
||||
b.Property<DateTime>("ModifiedDateUtc")
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("TIMESTAMP");
|
||||
|
||||
b.HasKey("FilterListId", "RuleId");
|
||||
|
||||
b.HasIndex("RuleId");
|
||||
|
||||
b.ToTable("filterlists_rules");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FilterLists.Data.Entities.FilterListSoftware", b =>
|
||||
{
|
||||
b.Property<int>("FilterListId");
|
||||
|
||||
b.Property<int>("SoftwareId");
|
||||
|
||||
b.Property<DateTime>("CreatedDateUtc")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("TIMESTAMP");
|
||||
|
||||
b.Property<DateTime>("ModifiedDateUtc")
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("TIMESTAMP");
|
||||
|
||||
b.HasKey("FilterListId", "SoftwareId");
|
||||
|
||||
b.HasIndex("SoftwareId");
|
||||
|
||||
b.ToTable("filterlists_software");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FilterLists.Data.Entities.Language", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<DateTime>("CreatedDateUtc")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("TIMESTAMP");
|
||||
|
||||
b.Property<string>("Iso6391")
|
||||
.HasMaxLength(2);
|
||||
|
||||
b.Property<string>("Iso6392")
|
||||
.HasMaxLength(3);
|
||||
|
||||
b.Property<string>("Iso6392B")
|
||||
.HasMaxLength(3);
|
||||
|
||||
b.Property<string>("Iso6392T")
|
||||
.HasMaxLength(3);
|
||||
|
||||
b.Property<string>("Iso6393")
|
||||
.HasMaxLength(3);
|
||||
|
||||
b.Property<string>("LocalName")
|
||||
.HasMaxLength(126);
|
||||
|
||||
b.Property<DateTime>("ModifiedDateUtc")
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("TIMESTAMP");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasMaxLength(126);
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("languages");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FilterLists.Data.Entities.License", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<DateTime>("CreatedDateUtc")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("TIMESTAMP");
|
||||
|
||||
b.Property<string>("DescriptionUrl")
|
||||
.HasMaxLength(2083);
|
||||
|
||||
b.Property<DateTime>("ModifiedDateUtc")
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("TIMESTAMP");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(126);
|
||||
|
||||
b.Property<bool>("PermissiveRedistribution");
|
||||
|
||||
b.Property<bool>("PermissiveUsage");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("licenses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FilterLists.Data.Entities.Maintainer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<DateTime>("CreatedDateUtc")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("TIMESTAMP");
|
||||
|
||||
b.Property<string>("EmailAddress")
|
||||
.HasMaxLength(126);
|
||||
|
||||
b.Property<string>("HomeUrl")
|
||||
.HasMaxLength(2083);
|
||||
|
||||
b.Property<DateTime>("ModifiedDateUtc")
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("TIMESTAMP");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(126);
|
||||
|
||||
b.Property<string>("TwitterHandle")
|
||||
.HasMaxLength(126);
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("maintainers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FilterLists.Data.Entities.Rule", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<DateTime>("CreatedDateUtc")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("TIMESTAMP");
|
||||
|
||||
b.Property<DateTime>("ModifiedDateUtc")
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("TIMESTAMP");
|
||||
|
||||
b.Property<string>("Raw")
|
||||
.HasMaxLength(2083);
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("rules");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FilterLists.Data.Entities.Software", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<DateTime>("CreatedDateUtc")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("TIMESTAMP");
|
||||
|
||||
b.Property<string>("DownloadUrl")
|
||||
.HasMaxLength(2083);
|
||||
|
||||
b.Property<string>("HomeUrl")
|
||||
.HasMaxLength(2083);
|
||||
|
||||
b.Property<DateTime>("ModifiedDateUtc")
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("TIMESTAMP");
|
||||
|
||||
b.Property<string>("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);
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
69
src/FilterLists.Api/Migrations/20171101011709_add License.cs
Normal file
69
src/FilterLists.Api/Migrations/20171101011709_add License.cs
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace FilterLists.Api.Migrations
|
||||
{
|
||||
public partial class addLicense : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "LicenseId",
|
||||
table: "filterlists",
|
||||
type: "int",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "licenses",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
CreatedDateUtc = table.Column<DateTime>(type: "TIMESTAMP", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
DescriptionUrl = table.Column<string>(type: "varchar(2083)", maxLength: 2083, nullable: true),
|
||||
ModifiedDateUtc = table.Column<DateTime>(type: "TIMESTAMP", nullable: false),
|
||||
Name = table.Column<string>(type: "varchar(126)", maxLength: 126, nullable: false),
|
||||
PermissiveRedistribution = table.Column<bool>(type: "bit", nullable: false),
|
||||
PermissiveUsage = table.Column<bool>(type: "bit", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_licenses", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_filterlists_LicenseId",
|
||||
table: "filterlists",
|
||||
column: "LicenseId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_filterlists_licenses_LicenseId",
|
||||
table: "filterlists",
|
||||
column: "LicenseId",
|
||||
principalTable: "licenses",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_filterlists_licenses_LicenseId",
|
||||
table: "filterlists");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "licenses");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_filterlists_LicenseId",
|
||||
table: "filterlists");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "LicenseId",
|
||||
table: "filterlists");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -50,6 +50,8 @@ protected override void BuildModel(ModelBuilder modelBuilder)
|
|||
b.Property<string>("IssuesUrl")
|
||||
.HasMaxLength(2083);
|
||||
|
||||
b.Property<int?>("LicenseId");
|
||||
|
||||
b.Property<int?>("MaintainerId");
|
||||
|
||||
b.Property<DateTime>("ModifiedDateUtc")
|
||||
|
|
@ -65,6 +67,8 @@ protected override void BuildModel(ModelBuilder modelBuilder)
|
|||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("LicenseId");
|
||||
|
||||
b.HasIndex("MaintainerId");
|
||||
|
||||
b.ToTable("filterlists");
|
||||
|
|
@ -172,6 +176,35 @@ protected override void BuildModel(ModelBuilder modelBuilder)
|
|||
b.ToTable("languages");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FilterLists.Data.Entities.License", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<DateTime>("CreatedDateUtc")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("TIMESTAMP");
|
||||
|
||||
b.Property<string>("DescriptionUrl")
|
||||
.HasMaxLength(2083);
|
||||
|
||||
b.Property<DateTime>("ModifiedDateUtc")
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("TIMESTAMP");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(126);
|
||||
|
||||
b.Property<bool>("PermissiveRedistribution");
|
||||
|
||||
b.Property<bool>("PermissiveUsage");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("licenses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FilterLists.Data.Entities.Maintainer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
|
|
@ -253,6 +286,10 @@ protected override void BuildModel(ModelBuilder modelBuilder)
|
|||
|
||||
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");
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ public class FilterList : BaseEntity
|
|||
public ICollection<FilterListLanguage> FilterListLanguages { get; set; }
|
||||
public ICollection<FilterListRule> FilterListRules { get; set; }
|
||||
public ICollection<FilterListSoftware> FilterListSoftware { get; set; }
|
||||
public int? LicenseId { get; set; }
|
||||
public int? MaintainerId { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string ViewUrl { get; set; }
|
||||
|
|
|
|||
13
src/FilterLists.Data/Entities/License.cs
Normal file
13
src/FilterLists.Data/Entities/License.cs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace FilterLists.Data.Entities
|
||||
{
|
||||
public class License : BaseEntity
|
||||
{
|
||||
public string DescriptionUrl { get; set; }
|
||||
public ICollection<FilterList> FilterLists { get; set; }
|
||||
public string Name { get; set; }
|
||||
public bool PermissiveRedistribution { get; set; }
|
||||
public bool PermissiveUsage { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
using FilterLists.Data.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace FilterLists.Data.EntityTypeConfigurations
|
||||
{
|
||||
public class LicenseTypeConfiguration : BaseEntityTypeConfiguration<License>
|
||||
{
|
||||
public override void Configure(EntityTypeBuilder<License> entityTypeBuilder)
|
||||
{
|
||||
entityTypeBuilder.ToTable("licenses");
|
||||
entityTypeBuilder.Property(b => b.DescriptionUrl)
|
||||
.HasMaxLength(2083);
|
||||
entityTypeBuilder.Property(b => b.Name)
|
||||
.IsRequired()
|
||||
.HasMaxLength(126);
|
||||
base.Configure(entityTypeBuilder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -13,6 +13,7 @@ public FilterListsDbContext(DbContextOptions options)
|
|||
|
||||
public DbSet<FilterList> FilterLists { get; set; }
|
||||
public DbSet<Language> Languages { get; set; }
|
||||
public DbSet<License> Licenses { get; set; }
|
||||
public DbSet<Maintainer> Maintainers { get; set; }
|
||||
public DbSet<Rule> Rules { get; set; }
|
||||
public DbSet<Software> Software { get; set; }
|
||||
|
|
@ -21,6 +22,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|||
{
|
||||
modelBuilder.ApplyConfiguration(new FilterListTypeConfiguration());
|
||||
modelBuilder.ApplyConfiguration(new LanguageTypeConfiguration());
|
||||
modelBuilder.ApplyConfiguration(new LicenseTypeConfiguration());
|
||||
modelBuilder.ApplyConfiguration(new MaintainerTypeConfiguration());
|
||||
modelBuilder.ApplyConfiguration(new RuleTypeConfiguration());
|
||||
modelBuilder.ApplyConfiguration(new SoftwareTypeConfiguration());
|
||||
|
|
|
|||
Loading…
Reference in a new issue