migration succesfull

This commit is contained in:
Natlinux81
2022-08-20 03:20:45 +02:00
parent 0418c55bf9
commit 7313cc9a21
6 changed files with 182 additions and 25 deletions

View File

@@ -0,0 +1,61 @@
// <auto-generated />
using System;
using Apollon.EntityFramework;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace Apollon.EntityFramework.Migrations
{
[DbContext(typeof(TournamentsDbContext))]
[Migration("20220820005557_initial")]
partial class initial
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.8")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
modelBuilder.Entity("Apollon.EntityFramework.DTOs.TournamentDto", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("Competition")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("EndDate")
.HasColumnType("datetime2");
b.Property<string>("Location")
.HasColumnType("nvarchar(max)");
b.Property<string>("Organisation")
.HasColumnType("nvarchar(max)");
b.Property<int>("Rounds")
.HasColumnType("int");
b.Property<DateTime>("StartDate")
.HasColumnType("datetime2");
b.Property<string>("TournamentName")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Tournaments");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,37 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Apollon.EntityFramework.Migrations
{
public partial class initial : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Tournaments",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Organisation = table.Column<string>(type: "nvarchar(max)", nullable: true),
TournamentName = table.Column<string>(type: "nvarchar(max)", nullable: true),
Competition = table.Column<string>(type: "nvarchar(max)", nullable: true),
StartDate = table.Column<DateTime>(type: "datetime2", nullable: false),
EndDate = table.Column<DateTime>(type: "datetime2", nullable: false),
Location = table.Column<string>(type: "nvarchar(max)", nullable: true),
Rounds = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Tournaments", x => x.Id);
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Tournaments");
}
}
}

View File

@@ -0,0 +1,59 @@
// <auto-generated />
using System;
using Apollon.EntityFramework;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace Apollon.EntityFramework.Migrations
{
[DbContext(typeof(TournamentsDbContext))]
partial class TournamentsDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.8")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
modelBuilder.Entity("Apollon.EntityFramework.DTOs.TournamentDto", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("Competition")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("EndDate")
.HasColumnType("datetime2");
b.Property<string>("Location")
.HasColumnType("nvarchar(max)");
b.Property<string>("Organisation")
.HasColumnType("nvarchar(max)");
b.Property<int>("Rounds")
.HasColumnType("int");
b.Property<DateTime>("StartDate")
.HasColumnType("datetime2");
b.Property<string>("TournamentName")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Tournaments");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -1,24 +0,0 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Apollon.EntityFramework
{
public class TournamentsDbContextFactory
{
private readonly DbContextOptions _options;
public TournamentsDbContextFactory(DbContextOptions options)
{
_options = options;
}
public TournamentsDbContext Create()
{
return new TournamentsDbContext(_options);
}
}
}

View File

@@ -0,0 +1,19 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Apollon.EntityFramework
{
public class TournamentsDesignTimeDbContextFactory : IDesignTimeDbContextFactory<TournamentsDbContext>
{
public TournamentsDbContext CreateDbContext(string[] args = null)
{
return new TournamentsDbContext(new DbContextOptionsBuilder().UseSqlServer("Data Source=NATHALIE-PC\\NATLINUXDB;Database=Apollon;Trusted_Connection=True;MultipleActiveResultSets=true").Options);
}
}
}