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

Feature/schiltz3/db migrate #48

Merged
merged 81 commits into from
Jan 18, 2023
Merged

Feature/schiltz3/db migrate #48

merged 81 commits into from
Jan 18, 2023

Conversation

schiltz3
Copy link
Collaborator

@schiltz3 schiltz3 commented Sep 15, 2022

Migrate database to clean up structure & rewrite database calls to match

Edit the structure

  • CODE => NAME
  • TITLE
  • INFO
  • ROLE_NAME
  • CHANNEL_NAME
  • ROLE_ID
  • CHANNEL_ID
  • UUID
  • + DUPE
  • + ACTIVE

This amounts to:

  • Removing UUID, ROLE_NAME and CHANNEL_NAME.
  • Cleaning up CODE and replacing it with NAME.
  • Adding the DUPE field to signify if a class is a duplicate.
  • Adding ACTIVE to specify if the course is being offered that semester. (Currently, all classes are considered active.)

Steps to migrate database and discord server

Run migrateDb command to migrate the database
Run CreateChannels command to update channel names from the database
Run CreateRoles command to update role names from the database

Link to github cards

#33
#35
#49
#50

Additions

  • Add a helper function to create embeds
  • Add migrateDB command to update the database to the new schema, update how duplicate codes are handled, and clean all strings.
  • Add modified JS Docs to function. (Types are not added since this is specified in function definitions with typescript)

Changes

  • Change db scheme
  • Change role and channel db calls to reflect changes
  • Change how duplicate classes are handled
  • Use course title and info in channel topics

Bugfix

  • replace all contiguous whitespace with a dash instead of replacing spaces with a dash
  • Replace contiguous dashes with a dash in ROLE_NAME and CHANNEL_NAME
  • Trim leading and trailing whitespace from TITLE
  • Limit role name and channel name to 100 characters each
  • Limit channel topic to 1024 characters each
  • Only reply to role selection if role is actually assigned
  • Add bottleneck package to limit the bot to 50 API calls per second
  • Prefers matching on channel ID's rather than names

@schiltz3 schiltz3 force-pushed the feature/schiltz3/db-migrate branch from 1c4186f to 3d35a4c Compare January 13, 2023 18:12
@schiltz3 schiltz3 marked this pull request as ready for review January 15, 2023 04:11
src/utils/embeds.ts Outdated Show resolved Hide resolved
src/utils/roles.ts Outdated Show resolved Hide resolved
Copy link
Member

@nathen418 nathen418 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@schiltz3 schiltz3 merged commit f3a0597 into staging Jan 18, 2023
@schiltz3 schiltz3 deleted the feature/schiltz3/db-migrate branch January 18, 2023 05:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants