You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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 replacedrop_owned_by_query = SQL('drop owned by {}').format(SQL(', ').join(role_identifiers))
withrevoke_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 thereporting
andrls
apps when creating migration tags.Exclude the compliance app from migrations (just like we did for reporting) to prevent pushing migrations to PROD.
The text was updated successfully, but these errors were encountered: