Compare commits
3 Commits
revert-reg
...
fkfix
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a1280d58bf | ||
| 34f0223a85 | |||
| 69f06f5868 |
@@ -329,13 +329,11 @@ public partial class LightlessWizardModule : InteractionModuleBase
|
|||||||
|
|
||||||
private int? ParseCharacterIdFromLodestoneUrl(string lodestoneUrl)
|
private int? ParseCharacterIdFromLodestoneUrl(string lodestoneUrl)
|
||||||
{
|
{
|
||||||
var regex = new Regex(@"https:\/\/(na|eu|de|fr|jp)\.finalfantasyxiv\.com\/lodestone\/character\/\d+");
|
var regex = new Regex(@"^https:\/\/(na|eu|de|fr|jp)\.finalfantasyxiv\.com\/lodestone\/character\/(\d+)/?$");
|
||||||
var matches = regex.Match(lodestoneUrl);
|
var matches = regex.Match(lodestoneUrl);
|
||||||
var isLodestoneUrl = matches.Success;
|
var isLodestoneUrl = matches.Success;
|
||||||
if (!isLodestoneUrl || matches.Groups.Count < 1) return null;
|
if (!isLodestoneUrl || matches.Groups.Count < 1) return null;
|
||||||
|
var stringId = matches.Groups[2].ToString();
|
||||||
lodestoneUrl = matches.Groups[0].ToString();
|
|
||||||
var stringId = lodestoneUrl.Split('/', StringSplitOptions.RemoveEmptyEntries).Last();
|
|
||||||
|
|
||||||
if (!int.TryParse(stringId, out int lodestoneId))
|
if (!int.TryParse(stringId, out int lodestoneId))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -91,6 +91,12 @@ public class LightlessDbContext : DbContext
|
|||||||
mb.Entity<GroupProfile>().ToTable("group_profiles");
|
mb.Entity<GroupProfile>().ToTable("group_profiles");
|
||||||
mb.Entity<GroupProfile>().HasKey(u => u.GroupGID);
|
mb.Entity<GroupProfile>().HasKey(u => u.GroupGID);
|
||||||
mb.Entity<GroupProfile>().HasIndex(c => c.GroupGID);
|
mb.Entity<GroupProfile>().HasIndex(c => c.GroupGID);
|
||||||
|
mb.Entity<Group>()
|
||||||
|
.HasOne(g => g.Profile)
|
||||||
|
.WithOne(p => p.Group)
|
||||||
|
.HasForeignKey<GroupProfile>(p => p.GroupGID)
|
||||||
|
.IsRequired(false)
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
mb.Entity<GroupTempInvite>().ToTable("group_temp_invites");
|
mb.Entity<GroupTempInvite>().ToTable("group_temp_invites");
|
||||||
mb.Entity<GroupTempInvite>().HasKey(u => new { u.GroupGID, u.Invite });
|
mb.Entity<GroupTempInvite>().HasKey(u => new { u.GroupGID, u.Invite });
|
||||||
mb.Entity<GroupTempInvite>().HasIndex(c => c.GroupGID);
|
mb.Entity<GroupTempInvite>().HasIndex(c => c.GroupGID);
|
||||||
|
|||||||
1319
LightlessSyncServer/LightlessSyncShared/Migrations/20251117153226_FixForeignKeyGroupProfiles.Designer.cs
generated
Normal file
1319
LightlessSyncServer/LightlessSyncShared/Migrations/20251117153226_FixForeignKeyGroupProfiles.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,41 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace LightlessSyncServer.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class FixForeignKeyGroupProfiles : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "fk_group_profiles_groups_group_gid",
|
||||||
|
table: "group_profiles");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "fk_group_profiles_groups_group_gid",
|
||||||
|
table: "group_profiles",
|
||||||
|
column: "group_gid",
|
||||||
|
principalTable: "groups",
|
||||||
|
principalColumn: "gid",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "fk_group_profiles_groups_group_gid",
|
||||||
|
table: "group_profiles");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "fk_group_profiles_groups_group_gid",
|
||||||
|
table: "group_profiles",
|
||||||
|
column: "group_gid",
|
||||||
|
principalTable: "groups",
|
||||||
|
principalColumn: "gid");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -820,14 +820,14 @@ namespace LightlessSyncServer.Migrations
|
|||||||
.HasColumnType("character varying(15)")
|
.HasColumnType("character varying(15)")
|
||||||
.HasColumnName("alias");
|
.HasColumnName("alias");
|
||||||
|
|
||||||
b.Property<bool>("HasVanity")
|
|
||||||
.HasColumnType("boolean")
|
|
||||||
.HasColumnName("has_vanity");
|
|
||||||
|
|
||||||
b.Property<bool>("ChatBanned")
|
b.Property<bool>("ChatBanned")
|
||||||
.HasColumnType("boolean")
|
.HasColumnType("boolean")
|
||||||
.HasColumnName("chat_banned");
|
.HasColumnName("chat_banned");
|
||||||
|
|
||||||
|
b.Property<bool>("HasVanity")
|
||||||
|
.HasColumnType("boolean")
|
||||||
|
.HasColumnName("has_vanity");
|
||||||
|
|
||||||
b.Property<bool>("IsAdmin")
|
b.Property<bool>("IsAdmin")
|
||||||
.HasColumnType("boolean")
|
.HasColumnType("boolean")
|
||||||
.HasColumnName("is_admin");
|
.HasColumnName("is_admin");
|
||||||
@@ -1220,6 +1220,7 @@ namespace LightlessSyncServer.Migrations
|
|||||||
b.HasOne("LightlessSyncShared.Models.Group", "Group")
|
b.HasOne("LightlessSyncShared.Models.Group", "Group")
|
||||||
.WithOne("Profile")
|
.WithOne("Profile")
|
||||||
.HasForeignKey("LightlessSyncShared.Models.GroupProfile", "GroupGID")
|
.HasForeignKey("LightlessSyncShared.Models.GroupProfile", "GroupGID")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.HasConstraintName("fk_group_profiles_groups_group_gid");
|
.HasConstraintName("fk_group_profiles_groups_group_gid");
|
||||||
|
|
||||||
b.Navigation("Group");
|
b.Navigation("Group");
|
||||||
|
|||||||
Reference in New Issue
Block a user