Commit 827c744c authored by Alexey Goikolov's avatar Alexey Goikolov

Создал и применил миграцию AddUserEntity

parent 877598ab
// <auto-generated />
using Lesson49.Models.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Lesson49.Migrations
{
[DbContext(typeof(MobileContext))]
[Migration("20210331150233_AddUserEntity")]
partial class AddUserEntity
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.13");
modelBuilder.Entity("Lesson49.Models.Brand", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<bool>("IsActive")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.HasColumnType("TEXT");
b.Property<string>("WebSite")
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("Brands");
});
modelBuilder.Entity("Lesson49.Models.Order", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Address")
.HasColumnType("TEXT");
b.Property<string>("ContactPhone")
.HasColumnType("TEXT");
b.Property<string>("Name")
.HasColumnType("TEXT");
b.Property<int>("PhoneId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("PhoneId");
b.ToTable("Orders");
});
modelBuilder.Entity("Lesson49.Models.Phone", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("BrandId")
.HasColumnType("INTEGER");
b.Property<bool>("IsDeleted")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.HasColumnType("TEXT");
b.Property<double>("Price")
.HasColumnType("REAL");
b.HasKey("Id");
b.HasIndex("BrandId");
b.ToTable("Phones");
});
modelBuilder.Entity("Lesson49.Models.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("Age")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.HasColumnType("TEXT");
b.Property<string>("Surname")
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("Users");
});
modelBuilder.Entity("Lesson49.Models.Order", b =>
{
b.HasOne("Lesson49.Models.Phone", "Phone")
.WithMany()
.HasForeignKey("PhoneId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Lesson49.Models.Phone", b =>
{
b.HasOne("Lesson49.Models.Brand", "Brand")
.WithMany()
.HasForeignKey("BrandId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}
using Microsoft.EntityFrameworkCore.Migrations;
namespace Lesson49.Migrations
{
public partial class AddUserEntity : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Users",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Name = table.Column<string>(nullable: true),
Surname = table.Column<string>(nullable: true),
Age = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Users", x => x.Id);
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Users");
}
}
}
...@@ -85,6 +85,26 @@ namespace Lesson49.Migrations ...@@ -85,6 +85,26 @@ namespace Lesson49.Migrations
b.ToTable("Phones"); b.ToTable("Phones");
}); });
modelBuilder.Entity("Lesson49.Models.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("Age")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.HasColumnType("TEXT");
b.Property<string>("Surname")
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("Users");
});
modelBuilder.Entity("Lesson49.Models.Order", b => modelBuilder.Entity("Lesson49.Models.Order", b =>
{ {
b.HasOne("Lesson49.Models.Phone", "Phone") b.HasOne("Lesson49.Models.Phone", "Phone")
......
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