Skip to content

feat: add manual db migration job with script support - #168

Open
inaki321 wants to merge 2 commits into
supabase-community:mainfrom
inaki321:feat/db-migration-job
Open

feat: add manual db migration job with script support#168
inaki321 wants to merge 2 commits into
supabase-community:mainfrom
inaki321:feat/db-migration-job

Conversation

@inaki321

@inaki321 inaki321 commented Apr 6, 2026

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

Feature

What is the current behavior?

Database initialization and migrations currently rely on ConfigMaps to inject SQL scripts.

Limitation: Kubernetes ConfigMaps are capped at 1MB.

Issue: This prevents users from performing large data migrations or restoring significant database dumps during the deployment process.

What is the new behavior?

Scripting: Instead of being restricted by etcd's size limits, the job can pull large .sql files directly from external storage (like AWS S3, Azure Storage, volumes etc).

Flexibility: Users can now define a custom scripts block to orchestrate the migration (e.g., downloading the dump, running pre-migration checks, and executing psql).

Backward Compatibility: The existing ConfigMap-based initialization remains untouched for small, schema-only setups.

Additional context

Production Migrations: Moving data between environments.

Initial Seeding: Populating the Supabase instance with large datasets that exceed the 1MB limit.

Example of migration job enabled

  job:
    enabled: true
image

@luizfelmach

Copy link
Copy Markdown
Contributor

I’m not sure this is the most ideal approach for running a SQL dump. Typically, this is something you’d want to perform only once, while a job might execute it multiple times if not carefully configured.

As an alternative, you could use kubectl cp to copy the required data into the pod and kubectl exec to apply the dump to the database. I’m assuming this process would usually be done just once.

That said, this proposal could still be incorporated — I just wanted to share this perspective, as it might not be the most appropriate use case for a job in this context.

@luizfelmach luizfelmach added the enhancement New feature or request label Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants