Skip to content

deploy.sh does not include alembic migrations — tables never created on first deploy #194

@sgarla

Description

@sgarla

Bug

scripts/deploy.sh copies server/, client/out/, app.yaml, and requirements.txt to the staging directory, but does not copy alembic/ or alembic.ini.

On app startup, run_migrations() searches for alembic.ini in these paths:

  • <app_root>/alembic.ini
  • /app/python/source_code/alembic.ini
  • ./alembic.ini

Since none of these exist in the deployed package, the migration is silently skipped. As a result, the database tables (projects, conversations, messages, project_backup, executions) are never created, and the app fails immediately on first use with:

psycopg.errors.UndefinedTable: relation "projects" does not exist

Steps to Reproduce

  1. Follow the deployment guide: create Lakebase, create app, add resource, configure app.yaml, run ./scripts/deploy.sh <app-name>
  2. Open the app URL
  3. Attempt to create a project → Error: Failed to create project

Fix

Add the following lines to the staging copy section of deploy.sh:

# Copy alembic migrations
cp alembic.ini "$STAGING_DIR/"
cp -r alembic "$STAGING_DIR/"

Workaround
Manually create the tables after first deploy by generating a Lakebase OAuth token and running create_tables() from a local Python session with LAKEBASE_PG_URL set.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions