Create unique index for DrawNumber and associated SQL Migration.
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
namespace lottery_co_uk_scraper.core.Models
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace lottery_co_uk_scraper.core.Models
|
||||
{
|
||||
[Index(nameof(DrawNumber), IsUnique = true)]
|
||||
public class LottoResult
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
164
lottery-co-uk-scraper.data/Migrations/20240207232756_AddKeyUniqueIndexToDrawNumber.Designer.cs
generated
Normal file
164
lottery-co-uk-scraper.data/Migrations/20240207232756_AddKeyUniqueIndexToDrawNumber.Designer.cs
generated
Normal file
@@ -0,0 +1,164 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using lottery_co_uk_scraper.data;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace lottery_co_uk_scraper.data.Migrations
|
||||
{
|
||||
[DbContext(typeof(LotteryContext))]
|
||||
[Migration("20240207232756_AddKeyUniqueIndexToDrawNumber")]
|
||||
partial class AddKeyUniqueIndexToDrawNumber
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.1")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("lottery_co_uk_scraper.core.Models.LottoResult", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("BallSetUsed")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateOnly>("DrawDate")
|
||||
.HasColumnType("date");
|
||||
|
||||
b.Property<int>("DrawNumber")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DrawnBall1")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DrawnBall2")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DrawnBall3")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DrawnBall4")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DrawnBall5")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DrawnBall6")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DrawnBonusBall")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("MachineUsed")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Matched2Prize")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Matched2PrizeFund")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Matched2RolldownPrize")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Matched3Prize")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Matched3PrizeFund")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Matched3RolldownPrize")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Matched4Prize")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Matched4PrizeFund")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Matched4RolldownPrize")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Matched5PlusBonusPrize")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Matched5PlusBonusPrizeFund")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Matched5PlusBonusRolldownPrize")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Matched5Prize")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Matched5PrizeFund")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Matched5RolldownPrize")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Matched6Prize")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Matched6PrizeFund")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Matched6RolldownPrize")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("Rolldown")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("Rollover")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<int>("TotalMatched2")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TotalMatched3")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TotalMatched4")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TotalMatched5")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TotalMatched5PlusBonus")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TotalMatched6")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TotalPrizeFund")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TotalWinners")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DrawNumber")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("LottoResults");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace lottery_co_uk_scraper.data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddKeyUniqueIndexToDrawNumber : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_LottoResults_DrawNumber",
|
||||
table: "LottoResults",
|
||||
column: "DrawNumber",
|
||||
unique: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_LottoResults_DrawNumber",
|
||||
table: "LottoResults");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -150,6 +150,9 @@ namespace lottery_co_uk_scraper.data.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DrawNumber")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("LottoResults");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
|
||||
Reference in New Issue
Block a user