Setup ef core tools and sqlite database with some entities
This commit is contained in:
68
BrightGlimmer.Data/Migrations/20190420001348_CreateDatabase.Designer.cs
generated
Normal file
68
BrightGlimmer.Data/Migrations/20190420001348_CreateDatabase.Designer.cs
generated
Normal file
@@ -0,0 +1,68 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using BrightGlimmer.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace BrightGlimmer.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(SqliteDatabaseContext))]
|
||||
[Migration("20190420001348_CreateDatabase")]
|
||||
partial class CreateDatabase
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "2.2.4-servicing-10062");
|
||||
|
||||
modelBuilder.Entity("BrightGlimmer.Data.Domain.Phone", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<int>("AreaCode");
|
||||
|
||||
b.Property<int>("Number");
|
||||
|
||||
b.Property<Guid?>("StudentId");
|
||||
|
||||
b.Property<int>("Type");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("StudentId");
|
||||
|
||||
b.ToTable("Phone");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BrightGlimmer.Data.Domain.Student", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<string>("Email");
|
||||
|
||||
b.Property<string>("FirstName");
|
||||
|
||||
b.Property<string>("LastName");
|
||||
|
||||
b.Property<string>("MiddleName");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Students");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BrightGlimmer.Data.Domain.Phone", b =>
|
||||
{
|
||||
b.HasOne("BrightGlimmer.Data.Domain.Student")
|
||||
.WithMany("Phones")
|
||||
.HasForeignKey("StudentId");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace BrightGlimmer.Data.Migrations
|
||||
{
|
||||
public partial class CreateDatabase : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Students",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(nullable: false),
|
||||
FirstName = table.Column<string>(nullable: true),
|
||||
MiddleName = table.Column<string>(nullable: true),
|
||||
LastName = table.Column<string>(nullable: true),
|
||||
Email = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Students", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Phone",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(nullable: false),
|
||||
Type = table.Column<int>(nullable: false),
|
||||
AreaCode = table.Column<int>(nullable: false),
|
||||
Number = table.Column<int>(nullable: false),
|
||||
StudentId = table.Column<Guid>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Phone", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Phone_Students_StudentId",
|
||||
column: x => x.StudentId,
|
||||
principalTable: "Students",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Phone_StudentId",
|
||||
table: "Phone",
|
||||
column: "StudentId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Phone");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Students");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using BrightGlimmer.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace BrightGlimmer.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(SqliteDatabaseContext))]
|
||||
partial class SqliteDatabaseContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "2.2.4-servicing-10062");
|
||||
|
||||
modelBuilder.Entity("BrightGlimmer.Data.Domain.Phone", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<int>("AreaCode");
|
||||
|
||||
b.Property<int>("Number");
|
||||
|
||||
b.Property<Guid?>("StudentId");
|
||||
|
||||
b.Property<int>("Type");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("StudentId");
|
||||
|
||||
b.ToTable("Phone");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BrightGlimmer.Data.Domain.Student", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<string>("Email");
|
||||
|
||||
b.Property<string>("FirstName");
|
||||
|
||||
b.Property<string>("LastName");
|
||||
|
||||
b.Property<string>("MiddleName");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Students");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BrightGlimmer.Data.Domain.Phone", b =>
|
||||
{
|
||||
b.HasOne("BrightGlimmer.Data.Domain.Student")
|
||||
.WithMany("Phones")
|
||||
.HasForeignKey("StudentId");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user