ef migration, add Author to List

This commit is contained in:
Collin M. Barrett 2017-06-25 11:50:27 -05:00
parent ddaadf2f06
commit 65fc02b3dd
3 changed files with 168 additions and 6 deletions

View file

@ -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<long>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("AddedDateUtc")
.ValueGeneratedOnAdd();
b.Property<string>("Author")
.HasMaxLength(126);
b.Property<string>("Description")
.HasMaxLength(1022);
b.Property<string>("DescriptionSourceUrl")
.HasMaxLength(2083);
b.Property<string>("DonateUrl")
.HasMaxLength(2083);
b.Property<string>("Email")
.HasMaxLength(126);
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(126);
b.Property<string>("ViewUrl")
.IsRequired()
.HasMaxLength(2083);
b.HasKey("Id");
b.ToTable("List");
});
}
}
}

View file

@ -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<string>(
name: "Name",
table: "List",
maxLength: 126,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 64,
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "ModifiedDateUtc",
table: "List",
nullable: true,
oldClrType: typeof(DateTime));
migrationBuilder.AlterColumn<string>(
name: "Email",
table: "List",
maxLength: 126,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 254,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Description",
table: "List",
maxLength: 1022,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 512,
oldNullable: true);
migrationBuilder.AddColumn<string>(
name: "Author",
table: "List",
maxLength: 126,
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Author",
table: "List");
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "List",
maxLength: 64,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 126,
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "ModifiedDateUtc",
table: "List",
nullable: false,
oldClrType: typeof(DateTime),
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Email",
table: "List",
maxLength: 254,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 126,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Description",
table: "List",
maxLength: 512,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 1022,
oldNullable: true);
}
}
}

View file

@ -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<long>("Id")
.ValueGeneratedOnAdd();
@ -23,8 +23,11 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.Property<DateTime>("AddedDateUtc")
.ValueGeneratedOnAdd();
b.Property<string>("Author")
.HasMaxLength(126);
b.Property<string>("Description")
.HasMaxLength(512);
.HasMaxLength(1022);
b.Property<string>("DescriptionSourceUrl")
.HasMaxLength(2083);
@ -33,7 +36,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.HasMaxLength(2083);
b.Property<string>("Email")
.HasMaxLength(254);
.HasMaxLength(126);
b.Property<string>("ForumUrl")
.HasMaxLength(2083);
@ -44,11 +47,11 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.Property<string>("IssuesUrl")
.HasMaxLength(2083);
b.Property<DateTime>("ModifiedDateUtc")
b.Property<DateTime?>("ModifiedDateUtc")
.ValueGeneratedOnAddOrUpdate();
b.Property<string>("Name")
.HasMaxLength(64);
.HasMaxLength(126);
b.Property<string>("ViewUrl")
.IsRequired()