Skip to content
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

refactor(Subscription): rename columns and adjust primary/foreign keys #2298

Merged

Conversation

wescopeland
Copy link
Member

This PR updates the Subscription table to get it more closely aligned with Laravel best practices.

A migration has been added which performs the following:

  • Drop the combined [SubjectType, SubjectID, UserID] primary key.
  • Add a id column as the new primary key.
  • Rename all columns:
    • SubjectType -> subject_type
    • SubjectID -> subject_id
    • UserID -> user_id
    • State -> state
    • Created -> created_at
    • Updated -> updated_at
  • Change user_id to an unsigned big integer.
  • Add a unique constraint to [subject_type, subject_id, user_id].
  • Add a foreign key from user_id to UserAccounts.ID.
  • Rename Subscription to subscriptions.

Additionally, the Subscription and User Eloquent models have been updated.

@wescopeland wescopeland requested a review from a team March 17, 2024 15:10
@wescopeland wescopeland requested a review from Jamiras March 18, 2024 22:20
@wescopeland wescopeland merged commit 073fe30 into RetroAchievements:master Mar 26, 2024
5 checks passed
@wescopeland wescopeland deleted the update-subscription-table branch March 26, 2024 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants