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

Move PG version check to awx-manage check_db & migrate commands #15463

Open
wants to merge 3 commits into
base: devel
Choose a base branch
from

Conversation

AlanCoding
Copy link
Member

SUMMARY

Similar to #15338, this is an action I very strongly want to get out of the __init__.py for management commands, which basically runs for every single thing we run.

The consequences of having it there go further than just performance. It causes us to open up a connection unexpectedly, whereas otherwise we wouldn't have. I saw this back when we were trying to improve our connection management, but changing, by nature, is opinionated.

By doing this, we would be shifting the burden to installers of AWX to assure that, if an external database is used, it must meet the minimum version. That can be done by:

  • running awx-manage check_db, which is not unreasonable, since installers already have to run a ton of management commands
  • just checking the database version with their own logic

Because this is asking some of installers, I expect it will be more difficult to get in than 15338, which is why I'm keeping it separate.

ISSUE TYPE
  • Bug, Docs Fix or other nominal change
COMPONENT NAME
  • API

@AlanCoding
Copy link
Member Author

I might change my feelings here, and try the pre_migrate signal instead. So we won't require installer changes.

@AlanCoding AlanCoding changed the title Move PG version check to check_db command Move PG version check to awx-manage check_db & migrate commands Aug 23, 2024
@AlanCoding AlanCoding marked this pull request as ready for review August 23, 2024 21:01
@AlanCoding
Copy link
Member Author

I think the updated approach here is solid. Marking ready for review.

@AlanCoding
Copy link
Member Author

demos:

bash-5.1$ awx-manage migrate
Operations to perform:
  Apply all migrations: auth, conf, contenttypes, dab_rbac, dab_resource_registry, main, oauth2_provider, sessions, sites, social_django, sso
CommandError: At a minimum, postgres version 18 is required, found 15

(forced a bit)

(awx) alancoding@Sourdough:~/repos/awx$ awx-manage migrate
Operations to perform:
  Apply all migrations: auth, conf, contenttypes, dab_rbac, dab_resource_registry, main, oauth2_provider, sessions, sites, social_django, sso
CommandError: Running server with 'sqlite' type database is not supported

Copy link

sonarcloud bot commented Aug 29, 2024

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.

1 participant