Skip to content

Commit

Permalink
Merge pull request #3 from davewalker5/add-migrations
Browse files Browse the repository at this point in the history
Added EF migrations
  • Loading branch information
davewalker5 committed Apr 13, 2020
2 parents 12da25e + d4e20ea commit fb9544f
Show file tree
Hide file tree
Showing 7 changed files with 377 additions and 3 deletions.
270 changes: 270 additions & 0 deletions src/FlightRecorder.Data/Migrations/20200413084833_security.Designer.cs

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

30 changes: 30 additions & 0 deletions src/FlightRecorder.Data/Migrations/20200413084833_security.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore.Migrations;

namespace FlightRecorder.Data.Migrations
{
public partial class security : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "USER",
columns: table => new
{
id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
UserName = table.Column<string>(type: "VARCHAR(50)", nullable: false),
Password = table.Column<string>(type: "VARCHAR(1000)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_USER", x => x.id);
});
}

protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "USER");
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// <auto-generated />
using System;
using System.Diagnostics.CodeAnalysis;
using FlightRecorder.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
Expand All @@ -9,14 +8,13 @@
namespace FlightRecorder.Data.Migrations
{
[DbContext(typeof(FlightRecorderDbContext))]
[ExcludeFromCodeCoverage]
partial class FlightRecorderDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.1");
.HasAnnotation("ProductVersion", "3.1.3");

modelBuilder.Entity("FlightRecorder.Entities.Db.Aircraft", b =>
{
Expand Down Expand Up @@ -195,6 +193,28 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.ToTable("SIGHTING");
});

modelBuilder.Entity("FlightRecorder.Entities.Db.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("INTEGER");
b.Property<string>("Password")
.IsRequired()
.HasColumnName("Password")
.HasColumnType("VARCHAR(1000)");
b.Property<string>("UserName")
.IsRequired()
.HasColumnName("UserName")
.HasColumnType("VARCHAR(50)");
b.HasKey("Id");
b.ToTable("USER");
});

modelBuilder.Entity("FlightRecorder.Entities.Db.Aircraft", b =>
{
b.HasOne("FlightRecorder.Entities.Db.Model", "Model")
Expand Down
28 changes: 28 additions & 0 deletions src/FlightRecorder.Migrations/FlightRecorder.Migrations.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\FlightRecorder.Data\FlightRecorder.Data.csproj" />
<ProjectReference Include="..\FlightRecorder.Entities\FlightRecorder.Entities.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.3" />
</ItemGroup>
<ItemGroup>
<None Remove="appsettings.json" />
</ItemGroup>
<ItemGroup>
<Content Include="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>
15 changes: 15 additions & 0 deletions src/FlightRecorder.Migrations/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
using FlightRecorder.Data;
using Microsoft.EntityFrameworkCore;

namespace FlightRecorder.Migrations
{
class Program
{
static void Main(string[] args)
{
FlightRecorderDbContext context = new FlightRecorderDbContextFactory().CreateDbContext(null);
context.Database.Migrate();
}
}
}
Loading

0 comments on commit fb9544f

Please sign in to comment.