Добавил города по-умолчанию в таблицу Cities

parent a948edca
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
# Mono auto generated files # Mono auto generated files
mono_crash.* mono_crash.*
.DS_Store
# Build results # Build results
[Dd]ebug/ [Dd]ebug/
......
// <auto-generated />
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using MyCities.Models;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace MyCities.Migrations
{
[DbContext(typeof(MyCitiesDbContext))]
[Migration("20190619144720_AddCitiesSeedData")]
partial class AddCitiesSeedData
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn)
.HasAnnotation("ProductVersion", "2.1.1-rtm-30846")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
modelBuilder.Entity("MyCities.Models.City", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Country");
b.Property<string>("Name");
b.Property<int>("Population");
b.HasKey("Id");
b.ToTable("Cities");
});
modelBuilder.Entity("MyCities.Models.Person", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AvatarImagePath");
b.Property<string>("FullName");
b.Property<string>("NickName");
b.HasKey("Id");
b.ToTable("Persons");
});
#pragma warning restore 612, 618
}
}
}
using Microsoft.EntityFrameworkCore.Migrations;
namespace MyCities.Migrations
{
public partial class AddCitiesSeedData : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.InsertData(
table: "Cities",
columns: new[] {"Id", "Country", "Name", "Population"},
values: new object[] {1, "Kazakhstan", "Almaty", 3000000}
);
migrationBuilder.InsertData(
table: "Cities",
columns: new[] {"Id", "Country", "Name", "Population"},
values: new object[] {2, "Russia", "Moscow", 12000000}
);
migrationBuilder.InsertData(
table: "Cities",
columns: new[] {"Id", "Country", "Name", "Population"},
values: new object[] {3, "USA", "New York", 7000000}
);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(table: "Cities", keyColumn: "Id", keyValues: new object[]{ 1,2,3 });
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment