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

Rename user table from auth_user to users_user #2016

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rhysyngsun
Copy link
Contributor

@rhysyngsun rhysyngsun commented Feb 5, 2025

NOTE: #2015 should be reviewed first

What are the relevant tickets?

Part of https://github.com/mitodl/hq/issues/6679

Description (What does it do?)

This renames the table as described. Additionally a Postgres view is created so the table is still accessible under the previous name so we don't see errors during deployment.

How can this be tested?

  • Before switching to this branch, you should probably backup your db:
    docker compose exec db pg_dump --file=/mnt/backups/dump.sql -U postgres -W -d postgres
  • Start the app, the migrations should succeed and the app should run.
  • Check the db schema, the following should be true:
    • The auth_user table should be renamed to users_user.
    • In the db, SELECT * from django_content_type WHERE model = 'user'; should show that the app_label has been updated to "users"

Be sure to ./manage.py migrate users 0001 before switching back to other branches

@rhysyngsun rhysyngsun force-pushed the nl/rename-user-table branch from bd4eb05 to de5a1dc Compare February 6, 2025 16:39
@rhysyngsun rhysyngsun marked this pull request as ready for review February 6, 2025 20:48
@rhysyngsun rhysyngsun added the Needs Review An open Pull Request that is ready for review label Feb 6, 2025
@rhysyngsun rhysyngsun force-pushed the nl/rename-user-table branch from de5a1dc to 4f45cf2 Compare February 6, 2025 22:35
@shanbady shanbady self-requested a review February 10, 2025 14:18
Copy link
Contributor

@shanbady shanbady left a comment

Choose a reason for hiding this comment

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

👍

@shanbady shanbady added Waiting on author and removed Needs Review An open Pull Request that is ready for review labels Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants