From 65fc02b3dd3479cb55cf819b1af54a81f4d83584 Mon Sep 17 00:00:00 2001 From: "Collin M. Barrett" Date: Sun, 25 Jun 2017 11:50:27 -0500 Subject: [PATCH] ef migration, add Author to List --- .../20170625164836_AddAuthor.Designer.cs | 67 ++++++++++++++ .../Migrations/20170625164836_AddAuthor.cs | 92 +++++++++++++++++++ .../FilterListsDbContextModelSnapshot.cs | 15 +-- 3 files changed, 168 insertions(+), 6 deletions(-) create mode 100644 src/FilterLists.Data/Migrations/20170625164836_AddAuthor.Designer.cs create mode 100644 src/FilterLists.Data/Migrations/20170625164836_AddAuthor.cs diff --git a/src/FilterLists.Data/Migrations/20170625164836_AddAuthor.Designer.cs b/src/FilterLists.Data/Migrations/20170625164836_AddAuthor.Designer.cs new file mode 100644 index 000000000..068faac5b --- /dev/null +++ b/src/FilterLists.Data/Migrations/20170625164836_AddAuthor.Designer.cs @@ -0,0 +1,67 @@ +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("20170625164836_AddAuthor")] + partial class AddAuthor + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { + modelBuilder + .HasAnnotation("ProductVersion", "1.1.2"); + + modelBuilder.Entity("FilterLists.Data.Models.List", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AddedDateUtc") + .ValueGeneratedOnAdd(); + + b.Property("Author") + .HasMaxLength(126); + + b.Property("Description") + .HasMaxLength(1022); + + b.Property("DescriptionSourceUrl") + .HasMaxLength(2083); + + b.Property("DonateUrl") + .HasMaxLength(2083); + + b.Property("Email") + .HasMaxLength(126); + + b.Property("ForumUrl") + .HasMaxLength(2083); + + b.Property("HomeUrl") + .HasMaxLength(2083); + + b.Property("IssuesUrl") + .HasMaxLength(2083); + + b.Property("ModifiedDateUtc") + .ValueGeneratedOnAddOrUpdate(); + + b.Property("Name") + .HasMaxLength(126); + + b.Property("ViewUrl") + .IsRequired() + .HasMaxLength(2083); + + b.HasKey("Id"); + + b.ToTable("List"); + }); + } + } +} diff --git a/src/FilterLists.Data/Migrations/20170625164836_AddAuthor.cs b/src/FilterLists.Data/Migrations/20170625164836_AddAuthor.cs new file mode 100644 index 000000000..998766816 --- /dev/null +++ b/src/FilterLists.Data/Migrations/20170625164836_AddAuthor.cs @@ -0,0 +1,92 @@ +using System; +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace FilterLists.Data.Migrations +{ + public partial class AddAuthor : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "Name", + table: "List", + maxLength: 126, + nullable: true, + oldClrType: typeof(string), + oldMaxLength: 64, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedDateUtc", + table: "List", + nullable: true, + oldClrType: typeof(DateTime)); + + migrationBuilder.AlterColumn( + name: "Email", + table: "List", + maxLength: 126, + nullable: true, + oldClrType: typeof(string), + oldMaxLength: 254, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "Description", + table: "List", + maxLength: 1022, + nullable: true, + oldClrType: typeof(string), + oldMaxLength: 512, + oldNullable: true); + + migrationBuilder.AddColumn( + name: "Author", + table: "List", + maxLength: 126, + nullable: true); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Author", + table: "List"); + + migrationBuilder.AlterColumn( + name: "Name", + table: "List", + maxLength: 64, + nullable: true, + oldClrType: typeof(string), + oldMaxLength: 126, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedDateUtc", + table: "List", + nullable: false, + oldClrType: typeof(DateTime), + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "Email", + table: "List", + maxLength: 254, + nullable: true, + oldClrType: typeof(string), + oldMaxLength: 126, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "Description", + table: "List", + maxLength: 512, + nullable: true, + oldClrType: typeof(string), + oldMaxLength: 1022, + oldNullable: true); + } + } +} diff --git a/src/FilterLists.Data/Migrations/FilterListsDbContextModelSnapshot.cs b/src/FilterLists.Data/Migrations/FilterListsDbContextModelSnapshot.cs index 92fea3ed4..f39c77a2e 100644 --- a/src/FilterLists.Data/Migrations/FilterListsDbContextModelSnapshot.cs +++ b/src/FilterLists.Data/Migrations/FilterListsDbContextModelSnapshot.cs @@ -13,9 +13,9 @@ partial class FilterListsDbContextModelSnapshot : ModelSnapshot protected override void BuildModel(ModelBuilder modelBuilder) { modelBuilder - .HasAnnotation("ProductVersion", "1.1.1"); + .HasAnnotation("ProductVersion", "1.1.2"); - modelBuilder.Entity("FilterLists.Models.List", b => + modelBuilder.Entity("FilterLists.Data.Models.List", b => { b.Property("Id") .ValueGeneratedOnAdd(); @@ -23,8 +23,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("AddedDateUtc") .ValueGeneratedOnAdd(); + b.Property("Author") + .HasMaxLength(126); + b.Property("Description") - .HasMaxLength(512); + .HasMaxLength(1022); b.Property("DescriptionSourceUrl") .HasMaxLength(2083); @@ -33,7 +36,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasMaxLength(2083); b.Property("Email") - .HasMaxLength(254); + .HasMaxLength(126); b.Property("ForumUrl") .HasMaxLength(2083); @@ -44,11 +47,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("IssuesUrl") .HasMaxLength(2083); - b.Property("ModifiedDateUtc") + b.Property("ModifiedDateUtc") .ValueGeneratedOnAddOrUpdate(); b.Property("Name") - .HasMaxLength(64); + .HasMaxLength(126); b.Property("ViewUrl") .IsRequired()