Fixed .xprr, closes #1608
This commit is contained in:
parent
3dfe5b8d55
commit
4f49b81dc1
1985
src/NadekoBot/Migrations/20170923002439_xprr-fix.Designer.cs
generated
Normal file
1985
src/NadekoBot/Migrations/20170923002439_xprr-fix.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
47
src/NadekoBot/Migrations/20170923002439_xprr-fix.cs
Normal file
47
src/NadekoBot/Migrations/20170923002439_xprr-fix.cs
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace NadekoBot.Migrations
|
||||||
|
{
|
||||||
|
public partial class xprrfix : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable("XpRoleReward");
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "XpRoleReward",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||||
|
.Annotation("Sqlite:Autoincrement", true),
|
||||||
|
DateAdded = table.Column<DateTime>(type: "TEXT", nullable: true),
|
||||||
|
Level = table.Column<int>(type: "INTEGER", nullable: false),
|
||||||
|
RoleId = table.Column<ulong>(type: "INTEGER", nullable: false),
|
||||||
|
XpSettingsId = table.Column<int>(type: "INTEGER", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_XpRoleReward", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_XpRoleReward_XpSettings_XpSettingsId",
|
||||||
|
column: x => x.XpSettingsId,
|
||||||
|
principalTable: "XpSettings",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_XpRoleReward_XpSettingsId_Level",
|
||||||
|
table: "XpRoleReward",
|
||||||
|
columns: new[] { "XpSettingsId", "Level" },
|
||||||
|
unique: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1559,13 +1559,12 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.Property<ulong>("RoleId");
|
b.Property<ulong>("RoleId");
|
||||||
|
|
||||||
b.Property<int?>("XpSettingsId");
|
b.Property<int>("XpSettingsId");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.HasAlternateKey("Level");
|
b.HasIndex("XpSettingsId", "Level")
|
||||||
|
.IsUnique();
|
||||||
b.HasIndex("XpSettingsId");
|
|
||||||
|
|
||||||
b.ToTable("XpRoleReward");
|
b.ToTable("XpRoleReward");
|
||||||
});
|
});
|
||||||
@ -1966,9 +1965,10 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.XpRoleReward", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.XpRoleReward", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("NadekoBot.Services.Database.Models.XpSettings")
|
b.HasOne("NadekoBot.Services.Database.Models.XpSettings", "XpSettings")
|
||||||
.WithMany("RoleRewards")
|
.WithMany("RoleRewards")
|
||||||
.HasForeignKey("XpSettingsId");
|
.HasForeignKey("XpSettingsId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.XpSettings", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.XpSettings", b =>
|
||||||
|
@ -18,17 +18,20 @@ namespace NadekoBot.Services.Database.Models
|
|||||||
|
|
||||||
public class XpRoleReward : DbEntity
|
public class XpRoleReward : DbEntity
|
||||||
{
|
{
|
||||||
|
public int XpSettingsId { get; set; }
|
||||||
|
public XpSettings XpSettings { get; set; }
|
||||||
|
|
||||||
public int Level { get; set; }
|
public int Level { get; set; }
|
||||||
public ulong RoleId { get; set; }
|
public ulong RoleId { get; set; }
|
||||||
|
|
||||||
public override int GetHashCode()
|
public override int GetHashCode()
|
||||||
{
|
{
|
||||||
return Level.GetHashCode() ^ RoleId.GetHashCode();
|
return Level.GetHashCode() ^ XpSettingsId.GetHashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Equals(object obj)
|
public override bool Equals(object obj)
|
||||||
{
|
{
|
||||||
return obj is XpRoleReward xrr && xrr.Level == Level && xrr.RoleId == RoleId;
|
return obj is XpRoleReward xrr && xrr.Level == Level && xrr.XpSettingsId == XpSettingsId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,7 +277,7 @@ namespace NadekoBot.Services.Database
|
|||||||
|
|
||||||
modelBuilder.Entity<DiscordUser>()
|
modelBuilder.Entity<DiscordUser>()
|
||||||
.Property(x => x.LastLevelUp)
|
.Property(x => x.LastLevelUp)
|
||||||
.HasDefaultValue(DateTime.Now);
|
.HasDefaultValue(new DateTime(2017, 9, 21, 20, 53, 13, 305, DateTimeKind.Local));
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -298,7 +298,8 @@ namespace NadekoBot.Services.Database
|
|||||||
|
|
||||||
modelBuilder.Entity<UserXpStats>()
|
modelBuilder.Entity<UserXpStats>()
|
||||||
.Property(x => x.LastLevelUp)
|
.Property(x => x.LastLevelUp)
|
||||||
.HasDefaultValue(DateTime.Now);
|
.HasDefaultValue(new DateTime(2017, 9, 21, 20, 53, 13, 307, DateTimeKind.Local));
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region XpSettings
|
#region XpSettings
|
||||||
@ -310,7 +311,8 @@ namespace NadekoBot.Services.Database
|
|||||||
//todo major bug
|
//todo major bug
|
||||||
#region XpRoleReward
|
#region XpRoleReward
|
||||||
modelBuilder.Entity<XpRoleReward>()
|
modelBuilder.Entity<XpRoleReward>()
|
||||||
.HasAlternateKey(x => x.Level);
|
.HasIndex(x => new { x.XpSettingsId, x.Level })
|
||||||
|
.IsUnique();
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Club
|
#region Club
|
||||||
|
Loading…
Reference in New Issue
Block a user