-
-
Notifications
You must be signed in to change notification settings - Fork 33
SQLModel Migration #853
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
electron271
wants to merge
15
commits into
main
Choose a base branch
from
sqlmodel
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
SQLModel Migration #853
Conversation
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
Reviewer's GuideThis PR overhauls the data layer by removing Prisma and its schema/commands, adding SQLModel and Alembic, providing an initial SQL migration, and defining new SQLModel-based schemas in a unified Python module. Class diagram for new SQLModel-based data modelsclassDiagram
class Guild {
+int guild_id
+datetime guild_joined_at
+int case_count
+GuildConfig config
+list~Starboard~ starboards
+list~Levels~ levels
+list~StarboardMessage~ starboard_messages
+list~AFKModel~ afk_models
+list~Case~ cases
+list~Snippet~ snippets
+list~Reminder~ reminders
+list~Note~ notes
}
class GuildConfig {
+int guild_id
+str prefix
+int mod_log_id
+int audit_log_id
+int join_log_id
+int private_log_id
+int report_log_id
+int dev_log_id
+int jail_channel_id
+int general_channel_id
+int starboard_channel_id
+int perm_level_0_role_id
+int perm_level_1_role_id
+int perm_level_2_role_id
+int perm_level_3_role_id
+int perm_level_4_role_id
+int perm_level_5_role_id
+int perm_level_6_role_id
+int perm_level_7_role_id
+int base_staff_role_id
+int base_member_role_id
+int jail_role_id
+int quarantine_role_id
+Guild guild
}
class Levels {
+int member_id
+float xp
+int level
+bool blacklisted
+datetime last_message
+int guild_id
+Guild guild
}
class Starboard {
+int guild_id
+int starboard_channel_id
+str starboard_emoji
+int starboard_threshold
+Guild guild
}
class StarboardMessage {
+int message_id
+str message_content
+datetime message_created_at
+datetime message_expires_at
+int message_channel_id
+int message_user_id
+int message_guild_id
+int star_count
+int starboard_message_id
+Guild guild
}
class AFKModel {
+int member_id
+str nickname
+str reason
+datetime since
+datetime until
+int guild_id
+bool enforced
+bool perm_afk
+Guild guild
}
class CaseType {
<<enum>>
OTHER
BAN
UNBAN
HACKBAN
TEMPBAN
KICK
SNIPPETBAN
TIMEOUT
UNTIMEOUT
WARN
JAIL
UNJAIL
SNIPPETUNBAN
UNTEMPBAN
POLLBAN
POLLUNBAN
}
class Case {
+int case_id
+bool case_status
+CaseType case_type
+str case_reason
+int case_moderator_id
+int case_user_id
+list~int~ case_user_roles
+int case_number
+datetime case_created_at
+datetime case_expires_at
+bool case_tempban_expired
+int guild_id
+Guild guild
}
class Snippet {
+int snippet_id
+str snippet_name
+str snippet_content
+int snippet_user_id
+datetime snippet_created_at
+int guild_id
+int uses
+bool locked
+str alias
+Guild guild
}
class Reminder {
+int reminder_id
+str reminder_content
+datetime reminder_created_at
+datetime reminder_expires_at
+int reminder_channel_id
+int reminder_user_id
+bool reminder_sent
+int guild_id
+Guild guild
}
class Note {
+int note_id
+int note_user_id
+int note_moderator_id
+str note_content
+datetime note_created_at
+int note_number
+int guild_id
+Guild guild
}
GuildConfig --|> Guild
Levels --|> Guild
Starboard --|> Guild
StarboardMessage --|> Guild
AFKModel --|> Guild
Case --|> Guild
Snippet --|> Guild
Reminder --|> Guild
Note --|> Guild
Case o-- CaseType
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Deploying tux with
|
Latest commit: |
b731cb5
|
Status: | ✅ Deploy successful! |
Preview URL: | https://989e9a72.tux-afh.pages.dev |
Branch Preview URL: | https://sqlmodel.tux-afh.pages.dev |
⏱️ 2m total CI duration on this PR
|
64f3638
to
1820520
Compare
…ded, started removal of prisma schemas
for more information, see https://pre-commit.ci
1 task
Dependency ReviewThe following issues were found:
License Issuespoetry.lock
OpenSSF ScorecardScorecard details
Scanned Files
|
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.
This will need to be done before 0.1.0
TODO
Packages
We would be using https://sqlmodel.tiangolo.com/ and https://github.com/sqlalchemy/alembic for migrations.
Drawbacks
Advantages
Areas migration will affect:
Alternative to #850
Closes #852
Summary by Sourcery
Migrate the project’s database layer from Prisma to SQLModel, introducing SQLModel-based table models and an initial Alembic migration SQL script while removing legacy Prisma schema files.
New Features:
Build:
Chores: