From acf3066d327bd14f3d75f4ac9f8ef39ef8abddb3 Mon Sep 17 00:00:00 2001 From: "Collin M. Barrett" Date: Mon, 10 Apr 2017 06:52:54 -0500 Subject: [PATCH] new EF migration for List model --- ...14552_FixListMaxMinAnnotations.Designer.cs | 64 ++++++++ ...20170410114552_FixListMaxMinAnnotations.cs | 139 ++++++++++++++++++ .../FilterListsDbContextModelSnapshot.cs | 14 +- api/FilterLists.Models/List.cs | 28 ++-- 4 files changed, 224 insertions(+), 21 deletions(-) create mode 100644 api/FilterLists.Data/Migrations/20170410114552_FixListMaxMinAnnotations.Designer.cs create mode 100644 api/FilterLists.Data/Migrations/20170410114552_FixListMaxMinAnnotations.cs diff --git a/api/FilterLists.Data/Migrations/20170410114552_FixListMaxMinAnnotations.Designer.cs b/api/FilterLists.Data/Migrations/20170410114552_FixListMaxMinAnnotations.Designer.cs new file mode 100644 index 000000000..1cfe2f522 --- /dev/null +++ b/api/FilterLists.Data/Migrations/20170410114552_FixListMaxMinAnnotations.Designer.cs @@ -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("Id") + .ValueGeneratedOnAdd(); + + b.Property("AddedDateUtc") + .ValueGeneratedOnAdd(); + + b.Property("Description") + .HasMaxLength(512); + + b.Property("DescriptionSourceUrl") + .HasMaxLength(2083); + + b.Property("DonateUrl") + .HasMaxLength(2083); + + b.Property("Email") + .HasMaxLength(254); + + b.Property("ForumUrl") + .HasMaxLength(2083); + + b.Property("HomeUrl") + .HasMaxLength(2083); + + b.Property("IssuesUrl") + .HasMaxLength(2083); + + b.Property("ModifiedDateUtc") + .ValueGeneratedOnAddOrUpdate(); + + b.Property("Name") + .HasMaxLength(64); + + b.Property("ViewUrl") + .IsRequired() + .HasMaxLength(2083); + + b.HasKey("Id"); + + b.ToTable("List"); + }); + } + } +} diff --git a/api/FilterLists.Data/Migrations/20170410114552_FixListMaxMinAnnotations.cs b/api/FilterLists.Data/Migrations/20170410114552_FixListMaxMinAnnotations.cs new file mode 100644 index 000000000..c0517417b --- /dev/null +++ b/api/FilterLists.Data/Migrations/20170410114552_FixListMaxMinAnnotations.cs @@ -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( + name: "ViewUrl", + table: "List", + maxLength: 2083, + nullable: false, + oldClrType: typeof(string), + oldMaxLength: 6); + + migrationBuilder.AlterColumn( + name: "IssuesUrl", + table: "List", + maxLength: 2083, + nullable: true, + oldClrType: typeof(string), + oldMaxLength: 6, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "HomeUrl", + table: "List", + maxLength: 2083, + nullable: true, + oldClrType: typeof(string), + oldMaxLength: 6, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ForumUrl", + table: "List", + maxLength: 2083, + nullable: true, + oldClrType: typeof(string), + oldMaxLength: 6, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "Email", + table: "List", + maxLength: 254, + nullable: true, + oldClrType: typeof(string), + oldMaxLength: 7, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "DonateUrl", + table: "List", + maxLength: 2083, + nullable: true, + oldClrType: typeof(string), + oldMaxLength: 6, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "DescriptionSourceUrl", + table: "List", + maxLength: 2083, + nullable: true, + oldClrType: typeof(string), + oldMaxLength: 6, + oldNullable: true); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "ViewUrl", + table: "List", + maxLength: 6, + nullable: false, + oldClrType: typeof(string), + oldMaxLength: 2083); + + migrationBuilder.AlterColumn( + name: "IssuesUrl", + table: "List", + maxLength: 6, + nullable: true, + oldClrType: typeof(string), + oldMaxLength: 2083, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "HomeUrl", + table: "List", + maxLength: 6, + nullable: true, + oldClrType: typeof(string), + oldMaxLength: 2083, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ForumUrl", + table: "List", + maxLength: 6, + nullable: true, + oldClrType: typeof(string), + oldMaxLength: 2083, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "Email", + table: "List", + maxLength: 7, + nullable: true, + oldClrType: typeof(string), + oldMaxLength: 254, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "DonateUrl", + table: "List", + maxLength: 6, + nullable: true, + oldClrType: typeof(string), + oldMaxLength: 2083, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "DescriptionSourceUrl", + table: "List", + maxLength: 6, + nullable: true, + oldClrType: typeof(string), + oldMaxLength: 2083, + oldNullable: true); + } + } +} diff --git a/api/FilterLists.Data/Migrations/FilterListsDbContextModelSnapshot.cs b/api/FilterLists.Data/Migrations/FilterListsDbContextModelSnapshot.cs index 7c4d04993..92fea3ed4 100644 --- a/api/FilterLists.Data/Migrations/FilterListsDbContextModelSnapshot.cs +++ b/api/FilterLists.Data/Migrations/FilterListsDbContextModelSnapshot.cs @@ -27,22 +27,22 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasMaxLength(512); b.Property("DescriptionSourceUrl") - .HasMaxLength(6); + .HasMaxLength(2083); b.Property("DonateUrl") - .HasMaxLength(6); + .HasMaxLength(2083); b.Property("Email") - .HasMaxLength(7); + .HasMaxLength(254); b.Property("ForumUrl") - .HasMaxLength(6); + .HasMaxLength(2083); b.Property("HomeUrl") - .HasMaxLength(6); + .HasMaxLength(2083); b.Property("IssuesUrl") - .HasMaxLength(6); + .HasMaxLength(2083); b.Property("ModifiedDateUtc") .ValueGeneratedOnAddOrUpdate(); @@ -52,7 +52,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("ViewUrl") .IsRequired() - .HasMaxLength(6); + .HasMaxLength(2083); b.HasKey("Id"); diff --git a/api/FilterLists.Models/List.cs b/api/FilterLists.Models/List.cs index 1eb0b9570..76a7a747d 100644 --- a/api/FilterLists.Models/List.cs +++ b/api/FilterLists.Models/List.cs @@ -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; } } } \ No newline at end of file