celestiaorg / celestiaorg/popsigner

Server cannot boot on a fresh database: migration 016 references a table no executed migration creates

Open
#22 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
4
Forks
2
PR merge metrics
No merged PRs in 30d

Description

### Summary

`RunMigrations` only executes `control-plane/internal/database/migrations`, but the `deployments` table referenced by `016_deployment_artifacts_and_transactions.up.sql` is created in `control-plane/internal/bootstrap/migrations` — a tree nothing in the codebase runs. A fresh database therefore cannot boot the server.

### Steps to reproduce

1. Point `cmd/server` at an empty PostgreSQL database.
2. Boot fails with: `Failed to run migrations: migration failed: relation "deployments" does not exist`.

### Proposed fix

Fold the bootstrap-tree schema (`001_deployments`, `004_deployment_org_id`, `005_add_pop_bundle_stack`) into the main tree as migration 013 (the 013–015 numbers are unused), guarded to be a no-op on databases where the bootstrap tree was applied by hand.

Contributor guide

Open the contributing guide

Research direction

Start with RunMigrations and compare control-plane/internal/database/migrations with control-plane/internal/bootstrap/migrations, especially 001_deployments, 004_deployment_org_id, 005_add_pop_bundle_stack, and 016_deployment_artifacts_and_transactions.up.sql. Verify the change by booting cmd/server against an empty PostgreSQL database and one where the bootstrap tree was applied manually; both should migrate without the deployments relation error.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, postgresql
Domain
backend, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.