new EF migration for List model

This commit is contained in:
Collin M. Barrett 2017-04-10 06:52:54 -05:00
parent 7aa4f12a24
commit acf3066d32
4 changed files with 224 additions and 21 deletions

View file

@ -0,0 +1,64 @@
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

@ -0,0 +1,139 @@
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

@ -27,22 +27,22 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.HasMaxLength(512);
b.Property<string>("DescriptionSourceUrl")
.HasMaxLength(6);
.HasMaxLength(2083);
b.Property<string>("DonateUrl")
.HasMaxLength(6);
.HasMaxLength(2083);
b.Property<string>("Email")
.HasMaxLength(7);
.HasMaxLength(254);
b.Property<string>("ForumUrl")
.HasMaxLength(6);
.HasMaxLength(2083);
b.Property<string>("HomeUrl")
.HasMaxLength(6);
.HasMaxLength(2083);
b.Property<string>("IssuesUrl")
.HasMaxLength(6);
.HasMaxLength(2083);
b.Property<DateTime>("ModifiedDateUtc")
.ValueGeneratedOnAddOrUpdate();
@ -52,7 +52,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.Property<string>("ViewUrl")
.IsRequired()
.HasMaxLength(6);
.HasMaxLength(2083);
b.HasKey("Id");

View file

@ -7,36 +7,36 @@ public class List : BaseEntity
[MaxLength(512)]
public string Description { get; set; }
[MaxLength(6)]
[MinLength(2083)]
[MaxLength(2083)]
[MinLength(6)]
public string DescriptionSourceUrl { get; set; }
[MaxLength(6)]
[MinLength(2083)]
[MaxLength(2083)]
[MinLength(6)]
public string DonateUrl { get; set; }
[MaxLength(7)]
[MinLength(254)]
[MaxLength(254)]
[MinLength(7)]
public string Email { get; set; }
[MaxLength(6)]
[MinLength(2083)]
[MaxLength(2083)]
[MinLength(6)]
public string ForumUrl { get; set; }
[MaxLength(6)]
[MinLength(2083)]
[MaxLength(2083)]
[MinLength(6)]
public string HomeUrl { get; set; }
[MaxLength(6)]
[MinLength(2083)]
[MaxLength(2083)]
[MinLength(6)]
public string IssuesUrl { get; set; }
[MaxLength(64)]
public string Name { get; set; }
[Required]
[MaxLength(6)]
[MinLength(2083)]
[MaxLength(2083)]
[MinLength(6)]
public string ViewUrl { get; set; }
}
}