cleanup, initial migration to new copy of db

This commit is contained in:
Collin M. Barrett 2017-04-10 17:42:16 -05:00
parent 2081fe8a23
commit 3615714b6c
19 changed files with 43 additions and 573 deletions

View file

@ -4,7 +4,6 @@ namespace FilterLists.Api.DependencyInjection.Extensions
{
public static class ConfigureServicesCollection
{
// ReSharper disable once UnusedMethodReturnValue.Global
public static IServiceCollection RegisterFilterListsApi(this IServiceCollection services)
{
services.AddMvc();

View file

@ -3,11 +3,8 @@
namespace FilterLists.Api
{
// ReSharper disable once UnusedMember.Global
public class Program
{
// ReSharper disable once UnusedMember.Global
// ReSharper disable once UnusedParameter.Global
public static void Main(string[] args)
{
var host = new WebHostBuilder()

View file

@ -9,7 +9,6 @@
namespace FilterLists.Api
{
// ReSharper disable once ClassNeverInstantiated.Global
public class Startup
{
public Startup(IHostingEnvironment env)
@ -22,7 +21,6 @@ public Startup(IHostingEnvironment env)
Configuration = builder.Build();
}
// ReSharper disable once MemberCanBePrivate.Global
public IConfigurationRoot Configuration { get; }
public void ConfigureServices(IServiceCollection services)

View file

@ -11,7 +11,6 @@ public FilterListsDbContext(DbContextOptions options)
{
}
// ReSharper disable once UnusedAutoPropertyAccessor.Global
public DbSet<List> List { get; set; }
}
}

View file

@ -11,7 +11,6 @@ namespace FilterLists.Data.DependencyInjection.Extensions
{
public static class ConfigureServicesCollection
{
// ReSharper disable once UnusedMethodReturnValue.Global
public static IServiceCollection RegisterFilterListsRepositories(this IServiceCollection services,
IConfiguration configuration)
{

View file

@ -1,52 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using FilterLists.Data.Contexts;
namespace FilterLists.Data.Migrations
{
[DbContext(typeof(FilterListsDbContext))]
[Migration("20170409192934_FilterListsMigration")]
partial class FilterListsMigration
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
modelBuilder
.HasAnnotation("ProductVersion", "1.1.1");
modelBuilder.Entity("FilterLists.Models.List", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("AddedDate");
b.Property<string>("Description");
b.Property<string>("DescriptionSourceUrl");
b.Property<string>("DonateUrl");
b.Property<string>("Email");
b.Property<string>("ForumUrl");
b.Property<string>("HomeUrl");
b.Property<string>("IssuesUrl");
b.Property<DateTime>("ModifiedDate");
b.Property<string>("Name");
b.Property<string>("ViewUrl");
b.HasKey("Id");
b.ToTable("List");
});
}
}
}

View file

@ -1,37 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace FilterLists.Data.Migrations
{
public partial class FilterListsMigration : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
"List",
table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("MySQL:AutoIncrement", true),
AddedDate = table.Column<DateTime>(nullable: false),
Description = table.Column<string>(nullable: true),
DescriptionSourceUrl = table.Column<string>(nullable: true),
DonateUrl = table.Column<string>(nullable: true),
Email = table.Column<string>(nullable: true),
ForumUrl = table.Column<string>(nullable: true),
HomeUrl = table.Column<string>(nullable: true),
IssuesUrl = table.Column<string>(nullable: true),
ModifiedDate = table.Column<DateTime>(nullable: false),
Name = table.Column<string>(nullable: true),
ViewUrl = table.Column<string>(nullable: true)
},
constraints: table => { table.PrimaryKey("PK_List", x => x.Id); });
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
"List");
}
}
}

View file

@ -1,64 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using FilterLists.Data.Contexts;
namespace FilterLists.Data.Migrations
{
[DbContext(typeof(FilterListsDbContext))]
[Migration("20170410020231_AddListAnnotations")]
partial class AddListAnnotations
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
modelBuilder
.HasAnnotation("ProductVersion", "1.1.1");
modelBuilder.Entity("FilterLists.Models.List", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("AddedDateUtc")
.ValueGeneratedOnAdd();
b.Property<string>("Description")
.HasMaxLength(512);
b.Property<string>("DescriptionSourceUrl")
.HasMaxLength(6);
b.Property<string>("DonateUrl")
.HasMaxLength(6);
b.Property<string>("Email")
.HasMaxLength(7);
b.Property<string>("ForumUrl")
.HasMaxLength(6);
b.Property<string>("HomeUrl")
.HasMaxLength(6);
b.Property<string>("IssuesUrl")
.HasMaxLength(6);
b.Property<DateTime>("ModifiedDateUtc")
.ValueGeneratedOnAddOrUpdate();
b.Property<string>("Name")
.HasMaxLength(64);
b.Property<string>("ViewUrl")
.IsRequired()
.HasMaxLength(6);
b.HasKey("Id");
b.ToTable("List");
});
}
}
}

View file

@ -1,181 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace FilterLists.Data.Migrations
{
public partial class AddListAnnotations : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
//migrationBuilder.DropColumn(
// name: "AddedDate",
// table: "List");
//migrationBuilder.DropColumn(
// "ModifiedDate",
// "List");
migrationBuilder.AlterColumn<string>(
"ViewUrl",
"List",
maxLength: 6,
nullable: false,
oldClrType: typeof(string),
oldNullable: true);
migrationBuilder.AlterColumn<string>(
"Name",
"List",
maxLength: 64,
nullable: true,
oldClrType: typeof(string),
oldNullable: true);
migrationBuilder.AlterColumn<string>(
"IssuesUrl",
"List",
maxLength: 6,
nullable: true,
oldClrType: typeof(string),
oldNullable: true);
migrationBuilder.AlterColumn<string>(
"HomeUrl",
"List",
maxLength: 6,
nullable: true,
oldClrType: typeof(string),
oldNullable: true);
migrationBuilder.AlterColumn<string>(
"ForumUrl",
"List",
maxLength: 6,
nullable: true,
oldClrType: typeof(string),
oldNullable: true);
migrationBuilder.AlterColumn<string>(
"Email",
"List",
maxLength: 7,
nullable: true,
oldClrType: typeof(string),
oldNullable: true);
migrationBuilder.AlterColumn<string>(
"DonateUrl",
"List",
maxLength: 6,
nullable: true,
oldClrType: typeof(string),
oldNullable: true);
migrationBuilder.AlterColumn<string>(
"DescriptionSourceUrl",
"List",
maxLength: 6,
nullable: true,
oldClrType: typeof(string),
oldNullable: true);
migrationBuilder.AddColumn<DateTime>(
"AddedDateUtc",
"List",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<DateTime>(
"ModifiedDateUtc",
"List",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
"AddedDateUtc",
"List");
migrationBuilder.DropColumn(
"ModifiedDateUtc",
"List");
migrationBuilder.AlterColumn<string>(
"ViewUrl",
"List",
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 6);
migrationBuilder.AlterColumn<string>(
"Name",
"List",
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 64,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
"IssuesUrl",
"List",
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 6,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
"HomeUrl",
"List",
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 6,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
"ForumUrl",
"List",
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 6,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
"Email",
"List",
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 7,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
"DonateUrl",
"List",
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 6,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
"DescriptionSourceUrl",
"List",
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 6,
oldNullable: true);
migrationBuilder.AddColumn<DateTime>(
"AddedDate",
"List",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<DateTime>(
"ModifiedDate",
"List",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
}
}
}

View file

@ -1,64 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using FilterLists.Data.Contexts;
namespace FilterLists.Data.Migrations
{
[DbContext(typeof(FilterListsDbContext))]
[Migration("20170410114552_FixListMaxMinAnnotations")]
partial class FixListMaxMinAnnotations
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
modelBuilder
.HasAnnotation("ProductVersion", "1.1.1");
modelBuilder.Entity("FilterLists.Models.List", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("AddedDateUtc")
.ValueGeneratedOnAdd();
b.Property<string>("Description")
.HasMaxLength(512);
b.Property<string>("DescriptionSourceUrl")
.HasMaxLength(2083);
b.Property<string>("DonateUrl")
.HasMaxLength(2083);
b.Property<string>("Email")
.HasMaxLength(254);
b.Property<string>("ForumUrl")
.HasMaxLength(2083);
b.Property<string>("HomeUrl")
.HasMaxLength(2083);
b.Property<string>("IssuesUrl")
.HasMaxLength(2083);
b.Property<DateTime>("ModifiedDateUtc")
.ValueGeneratedOnAddOrUpdate();
b.Property<string>("Name")
.HasMaxLength(64);
b.Property<string>("ViewUrl")
.IsRequired()
.HasMaxLength(2083);
b.HasKey("Id");
b.ToTable("List");
});
}
}
}

View file

@ -1,139 +0,0 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
namespace FilterLists.Data.Migrations
{
public partial class FixListMaxMinAnnotations : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "ViewUrl",
table: "List",
maxLength: 2083,
nullable: false,
oldClrType: typeof(string),
oldMaxLength: 6);
migrationBuilder.AlterColumn<string>(
name: "IssuesUrl",
table: "List",
maxLength: 2083,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 6,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "HomeUrl",
table: "List",
maxLength: 2083,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 6,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ForumUrl",
table: "List",
maxLength: 2083,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 6,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Email",
table: "List",
maxLength: 254,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 7,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "DonateUrl",
table: "List",
maxLength: 2083,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 6,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "DescriptionSourceUrl",
table: "List",
maxLength: 2083,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 6,
oldNullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "ViewUrl",
table: "List",
maxLength: 6,
nullable: false,
oldClrType: typeof(string),
oldMaxLength: 2083);
migrationBuilder.AlterColumn<string>(
name: "IssuesUrl",
table: "List",
maxLength: 6,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 2083,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "HomeUrl",
table: "List",
maxLength: 6,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 2083,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ForumUrl",
table: "List",
maxLength: 6,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 2083,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Email",
table: "List",
maxLength: 7,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 254,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "DonateUrl",
table: "List",
maxLength: 6,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 2083,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "DescriptionSourceUrl",
table: "List",
maxLength: 6,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 2083,
oldNullable: true);
}
}
}

View file

@ -1,19 +0,0 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
namespace FilterLists.Data.Migrations
{
public partial class SetDefaultDateValue : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
}
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

View file

@ -8,8 +8,8 @@
namespace FilterLists.Data.Migrations
{
[DbContext(typeof(FilterListsDbContext))]
[Migration("20170410130859_SetDefaultDateValue")]
partial class SetDefaultDateValue
[Migration("20170410220415_Initial")]
partial class Initial
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{

View file

@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
namespace FilterLists.Data.Migrations
{
public partial class Initial : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "List",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("MySQL:AutoIncrement", true),
AddedDateUtc = table.Column<DateTime>(nullable: false),
Description = table.Column<string>(maxLength: 512, nullable: true),
DescriptionSourceUrl = table.Column<string>(maxLength: 2083, nullable: true),
DonateUrl = table.Column<string>(maxLength: 2083, nullable: true),
Email = table.Column<string>(maxLength: 254, nullable: true),
ForumUrl = table.Column<string>(maxLength: 2083, nullable: true),
HomeUrl = table.Column<string>(maxLength: 2083, nullable: true),
IssuesUrl = table.Column<string>(maxLength: 2083, nullable: true),
ModifiedDateUtc = table.Column<DateTime>(nullable: false),
Name = table.Column<string>(maxLength: 64, nullable: true),
ViewUrl = table.Column<string>(maxLength: 2083, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_List", x => x.Id);
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "List");
}
}
}

View file

@ -6,7 +6,6 @@
namespace FilterLists.Data.Repositories
{
// ReSharper disable once ClassNeverInstantiated.Global
public class ListRepository : IListRepository
{
private readonly FilterListsDbContext _filterListsDbContext;

View file

@ -4,11 +4,9 @@
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Diagnostics.CodeAnalysis;
namespace FilterLists.Models
{
[SuppressMessage("ReSharper", "UnusedMember.Global")]
public abstract class BaseEntity
{
[Key]

View file

@ -3,8 +3,6 @@
namespace FilterLists.Models
{
[SuppressMessage("ReSharper", "UnusedMember.Global")]
// ReSharper disable once ClassNeverInstantiated.Global
public class List : BaseEntity
{
[MaxLength(512)]

View file

@ -5,7 +5,6 @@ namespace FilterLists.Services.DependencyInjection.Extensions
{
public static class ConfigureServicesCollection
{
// ReSharper disable once UnusedMethodReturnValue.Global
public static IServiceCollection RegisterFilterListsServices(this IServiceCollection services)
{
services.TryAddScoped<IListService, ListService>();

View file

@ -4,7 +4,6 @@
namespace FilterLists.Services
{
// ReSharper disable once ClassNeverInstantiated.Global
public class ListService : IListService
{
private readonly IListRepository _listRepository;