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

Preparing Django migration commands and release tagging before PROD #2939

Open
4 tasks done
Sepehr-Sobhani opened this issue Mar 1, 2025 · 2 comments
Open
4 tasks done

Comments

@Sepehr-Sobhani
Copy link
Contributor

Sepehr-Sobhani commented Mar 1, 2025

Describe the task

We need to make a few minor adjustments to our commands and code to ensure that our Django commands are compatible with production environments and we don't run into issues when going to PROD:

  • In the revoke_all_privileges command we need to replace drop_owned_by_query = SQL('drop owned by {}').format(SQL(', ').join(role_identifiers)) with revoke_all_privileges_query = SQL("revoke all privileges on all tables in schema erc from {}").format(SQL(', ').join(role_identifiers)) This change is necessary because the DB user is not permitted to run DROP commands related to other users. Additionally, we've noticed that these user roles do not own any objects, so it's sufficient to simply revoke their privileges. This ensures that we always have the updated grants.

  • In the custom_migrate command we no longer need to check this condition: apps_to_run_default_migrate = [app for app in all_apps if app != 'reporting'] because we are now migrating all reporting migrations up to the last one. The only task left for this command is to load test or dev data. Therefore, we can simplify the logic: if we are in the PROD environment, we just run the migrate command. However, if we are in any other environment, we load the corresponding fixtures.

  • We need to update the create_empty_migrations command to include the reporting and rls apps when creating migration tags.

  • Exclude the compliance app from migrations (just like we did for reporting) to prevent pushing migrations to PROD.

@Sepehr-Sobhani
Copy link
Contributor Author

@patriciarussellCAS
Copy link

patriciarussellCAS commented Mar 3, 2025

Tagging @joshgamache

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants