Skip to content

fix: initialize deployment databases and unblock guests - #54

Merged
avatarneil merged 3 commits into
feat/bracket-sharingfrom
feat/production-migrations
Sep 14, 2026
Merged

avatarneil merged 3 commits into
feat/bracket-sharingfrom
feat/production-migrations

Conversation

@avatarneil

@avatarneil avatarneil commented Sep 14, 2026

Copy link
Copy Markdown
Owner

Public brackets now remain usable when Clerk fails or is slow to initialize. Removing the global auth-loading gate fixes the infinite “Loading bracket…” screen; a stable guest state key preserves typed input when guest auth finishes. Browser saves remain scoped by account. New Chromium and Firefox tests cover blocked Clerk scripts and delayed initialization.

Production and preview deployments now apply committed Drizzle migrations automatically before the Next.js build. Vercel's versioned build command runs the package build script, which invokes the deployment migration runner. Missing direct connection credentials or a failed migration stops the build.

A PostgreSQL session advisory lock serializes concurrent migration attempts on one direct connection. Drizzle's migration ledger makes retries idempotent; errors do not print connection details. Each preview migrates its own integration-provided database branch; local builds skip deployment migrations. The runtime and migration URLs must target the same database.

Set both DATABASE_URL (pooled) and DATABASE_URL_UNPOOLED (direct) in Vercel Production using Neon's main branch. No manual deployment migration is needed. Configure both URLs for each preview through the Neon integration. Schema changes must remain compatible with the running app because migrations precede traffic switching; deployment rollback does not reverse schema changes.

Validation: production build, lint (no new warnings), and all twelve migration/storage/unit tests passed against the isolated Neon development branch. CI also tests concurrent migration runners against a fresh Postgres service before running ownership and sharing tests. Production credentials and hosting settings remain user-managed.

Preview storage fix: confirmed the top preview was missing account_brackets and applied the schema to that isolated branch. All twelve migration/storage tests pass, including preview-mode migration and rejection of mismatched connection targets.

@avatarneil
avatarneil added this pull request to stack #53 September 14, 2026 00:17
@vercel

vercel Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
nfl-playoff-bracket Ready Ready Preview Sep 14, 2026 12:56am UTC

Request Review

@avatarneil avatarneil changed the title ci(db): migrate before production builds fix: unblock guest brackets and automate migrations Sep 14, 2026
@avatarneil avatarneil changed the title fix: unblock guest brackets and automate migrations fix: initialize deployment databases and unblock guests Sep 14, 2026
Serialize migrations on a direct Postgres connection and block deployment when migration setup or execution fails. Preview and local builds skip production migrations.
Remove the global Clerk loading gate that left public pages hanging when auth failed. Keep a stable guest key and preserve browser saves while identity resolves.
Run migrations for each Vercel preview as well as production. Reject mismatched runtime and migration database targets so schema changes cannot silently land on a different branch.
@avatarneil
avatarneil force-pushed the feat/production-migrations branch from f6e36ca to e606d03 Compare September 14, 2026 00:55
@avatarneil
avatarneil merged commit 62eb245 into main Sep 14, 2026
10 checks passed
@avatarneil
avatarneil deleted the feat/production-migrations branch September 14, 2026 01:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant