feat: implement new whitelist and social connections tables with upda…#1
Open
TheBjoRedCraft wants to merge 2 commits intoversion/1.21.11from
Open
feat: implement new whitelist and social connections tables with upda…#1TheBjoRedCraft wants to merge 2 commits intoversion/1.21.11from
TheBjoRedCraft wants to merge 2 commits intoversion/1.21.11from
Conversation
…ted database queries
There was a problem hiding this comment.
Pull request overview
Implements a new database schema split between “social connections” and “freebuild whitelist” data, and updates the whitelist lookup queries to use the new tables.
Changes:
- Introduces new
SocialConnectionsTableandFreebuildWhitelistTabletables and creates them at startup. - Updates
WhitelistServicequeries to read whitelist state via anINNER JOINover the new tables. - Adjusts
WhitelistEntry.discordUserIdto be nullable and bumps the project snapshot version.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/kotlin/dev/slne/surf/freebuild/whitelist/entry/WhitelistEntry.kt | Makes discordUserId nullable to reflect new schema. |
| src/main/kotlin/dev/slne/surf/freebuild/whitelist/database/table/SocialsTable.kt | Renames mapped table to social_connections_new (now overlaps with new table mapping). |
| src/main/kotlin/dev/slne/surf/freebuild/whitelist/database/table/SocialConnectionsTable.kt | Adds new auditable “social connections” table mapping. |
| src/main/kotlin/dev/slne/surf/freebuild/whitelist/database/table/FreebuildWhitelistTable.kt | Adds new auditable “freebuild whitelist” table mapping with FK to social connections. |
| src/main/kotlin/dev/slne/surf/freebuild/whitelist/database/service/WhitelistService.kt | Updates whitelist queries to join new tables and map result rows. |
| src/main/kotlin/dev/slne/surf/freebuild/whitelist/database/DatabaseLoader.kt | Creates the new tables via SchemaUtils.create. |
| gradle.properties | Bumps snapshot version. |
Comments suppressed due to low confidence (1)
src/main/kotlin/dev/slne/surf/freebuild/whitelist/database/table/SocialsTable.kt:13
SocialsTablenow points to the same physical table name (social_connections_new) asSocialConnectionsTable, but defines a different set of columns (e.g.,blocked,created_at,updated_at). Keeping two Exposed table objects for the same table with divergent schemas is error-prone and can lead to incorrect queries or schema creation later. Consider removingSocialsTableentirely (it appears unused) or renaming/repointing it so only one table mapping exists per DB table name.
object SocialsTable : LongIdTable("social_connections_new") {
val discordUserId = long("discord_user_id").uniqueIndex()
val minecraftUuid = nativeUuid("minecraft_uuid").uniqueIndex()
val twitchId = long("twitch_id").uniqueIndex().nullable()
val blocked = bool("blocked").default(false)
val createdAt = offsetDateTime("created_at")
val updatedAt = offsetDateTime("updated_at")
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…ted database queries