Skip to content

Commit

Permalink
Executing EF Core migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
gorohoroh committed Jul 6, 2018
1 parent fd5b304 commit 287e652
Show file tree
Hide file tree
Showing 6 changed files with 236 additions and 0 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using System;
using System.Collections.Generic;

namespace OdeToFoodRider.Migrations
{
public partial class InitialCreate : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Restaurants",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
Cuisine = table.Column<int>(nullable: false),
Name = table.Column<string>(maxLength: 80, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Restaurants", x => x.Id);
});
}

protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Restaurants");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// <auto-generated />
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.EntityFrameworkCore.Storage.Internal;
using OdeToFoodRider.Data;
using OdeToFoodRider.Models;
using System;

namespace OdeToFoodRider.Migrations
{
[DbContext(typeof(OdeToFoodDbContext))]
partial class OdeToFoodDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.0.3-rtm-10026")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);

modelBuilder.Entity("OdeToFoodRider.Models.Restaurant", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("Cuisine");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(80);
b.HasKey("Id");
b.ToTable("Restaurants");
});
#pragma warning restore 612, 618
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using System;
using System.Collections.Generic;

namespace OdeToFoodVisualStudio.Migrations
{
public partial class InitialCreate : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Restaurants",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
Cuisine = table.Column<int>(nullable: false),
Name = table.Column<string>(maxLength: 80, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Restaurants", x => x.Id);
});
}

protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Restaurants");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// <auto-generated />
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.EntityFrameworkCore.Storage.Internal;
using OdeToFoodVisualStudio.Data;
using OdeToFoodVisualStudio.Models;
using System;

namespace OdeToFoodVisualStudio.Migrations
{
[DbContext(typeof(OdeToFoodDbContext))]
partial class OdeToFoodDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.0.3-rtm-10026")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);

modelBuilder.Entity("OdeToFoodVisualStudio.Models.Restaurant", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("Cuisine");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(80);
b.HasKey("Id");
b.ToTable("Restaurants");
});
#pragma warning restore 612, 618
}
}
}

0 comments on commit 287e652

Please sign in to comment.