firebase / firebase/firebase-tools

dataconnect: Need a --force-reset / --drop-tables flag for blocked schema migrations in development

Open
#10,907 0 comments 0 reactions 0 assignees View on GitHub
api: dataconnect type: feature request
Dominant language
TypeScript
Stars
4.5k
Forks
1.3k
Avg merge
1d 12h
Merged PRs (30d)
84

Description

When prototyping or iterating on a Data Connect GraphQL schema, updating fields that involve underlying constraints (e.g., unique indices or foreign key constraints) can cause firebase dataconnect:sql:migrate to fail with unrecoverable SQL DDL errors (e.g., undroppable indices).

Once this happens, the CLI migration command halts completely and provides no automated recourse to reset or force-apply the schema.

To resolve this currently, a developer must manually log into the GCP Console and use Cloud SQL Studio to run DROP TABLE ... CASCADE;. However, accessing Cloud SQL Studio requires an active Cloud Billing account. For developers prototyping on free-tier or trial setups, this forces an unnecessary loop of upgrading to a paid plan just to drop tables in a dev database, then downgrading again.

You could introduce a CLI flag like firebase dataconnect:sql:migrate --force-reset or firebase dataconnect:sql:reset that executes a full schema tear-down/re-initialization (DROP SCHEMA public CASCADE; CREATE SCHEMA public;) directly from the CLI during development sessions.

Contributor guide

Open the contributing guide

Research direction

Review the `firebase dataconnect:sql:migrate` entry point and the SQL migration path, starting with how undroppable-index DDL errors are surfaced. Compare the proposed reset or force behavior with development-only safety needs; done means a blocked migration can be reset from the CLI without requiring Cloud SQL Studio.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, sql, typescript
Domain
cli, databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.