Skip to content

Conversation

@TommrraraSnow
Copy link
Member

Summary

  • add the packaged Alembic migrations directory to the PyInstaller datas list so client builds ship the scripts needed for automatic upgrades

Testing

  • pytest tests/api/test_connection.py

https://chatgpt.com/codex/tasks/task_e_68eca5f50d30832d9a6ebf6bc0fc9ec4

@github-actions
Copy link

🤖 Hi @TommrraraSnow, I've received your request, and I'm working on it now! You can track my progress in the logs for more details.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting

Comment on lines +11 to +13
PROJECT_ROOT = Path(__file__).resolve().parents[5]
if str(PROJECT_ROOT) not in sys.path:
sys.path.insert(0, str(PROJECT_ROOT))

Choose a reason for hiding this comment

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

P1 Badge Avoid hard-coded parent depth when loading packaged migrations

The new Alembic env now computes PROJECT_ROOT with Path(__file__).resolve().parents[5]. That works when the migrations live on disk at /…/zsim/api_src/services/database/migrations, but when run_migrations_to_head() loads the scripts via importlib.resources.as_file in a PyInstaller build the directory is extracted to a temporary folder such as /tmp/tmpabcd/migrations. In that context the parents sequence has fewer than six elements and this line raises IndexError before migrations run, causing the packaged API to crash during startup. Consider deriving the project root more defensively (e.g. walk up until you find the zsim package or guard against short paths) so the code works both in-source and when migrations are extracted to a flat temporary directory.

Useful? React with 👍 / 👎.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants