Repository navigation
Description
Where did this happen?
Building from source
Version
main at 9a50076 (macOS, Apple Silicon, Bun 1.3.10, Docker Desktop)
What happened?
./.superset/setup.local.sh on a fresh clone finishes with Apply migrations and Seed dev account failed, so the dev app has no local account to sign in with. There are two independent causes.
-
drizzle-kit uses the Neon websocket driver against plain Postgres.
packages/dbrunsdrizzle-kit migrateagainstDATABASE_URL_UNPOOLED(postgres://…@localhost:<LOCAL_PG_PORT>/main, direct Postgres). drizzle-kit chooses its driver from whatever packages it can resolve. Neitherpgnorpostgresis installed in the workspace, only@neondatabase/serverless, so it logsUsing '@neondatabase/serverless' driverand fails withECONNREFUSEDon the first query (CREATE SCHEMA IF NOT EXISTS "drizzle"). The comment insetup.local.shsays "migrate uses direct pg", but nothing provides that driver. -
A migration needs Postgres 18, but local Docker runs 17.
docker-compose.ymlpinsimage: postgres:17. Migration0122_webhook_events_swap_to_short_retention.sqlrenameswebhook_events_swap_id_not_null→webhook_events_id_not_null. Postgres only creates named NOT NULL constraints from version 18, so on 17 the constraint doesn't exist and the migration fails. Neon presumably runs 18, which is why this only shows up locally.
Expected: setup.local.sh migrates and seeds a fresh local stack without manual steps.
Steps to reproduce
- Fresh clone,
bun install(or just run the setup script). ./.superset/setup.local.sh- The summary lists Failed steps: Apply migrations, Seed dev account. Seeding fails with
relation "auth.users" does not existbecause migrations never ran.
What made it pass for me (local workaround, not a proposed patch):
- Make
pgresolvable frompackages/db. drizzle-kit then logsUsing 'pg' driver. - Run the stack on
postgres:18, withPGDATA=/var/lib/postgresql/datato keep the existing volume mount working. With both changes,bun run db:migrateandbun run db:seed-devsucceed.
Possible fixes: add pg as a devDependency of packages/db (or set an explicit driver in drizzle.config.ts), and bump the compose image to postgres:18.
Logs, screenshots, or recordings
$ drizzle-kit migrate
Using '@neondatabase/serverless' driver for database querying
Warning '@neondatabase/serverless' can only connect to remote Neon/Vercel Postgres/Supabase instances through a websocket
DrizzleQueryError: Failed query: CREATE SCHEMA IF NOT EXISTS "drizzle"
[cause]: AggregateError [ECONNREFUSED]
After making pg available, on postgres:17:
Using 'pg' driver for database querying
DrizzleQueryError: Failed query:
ALTER TABLE "ingest"."webhook_events" RENAME CONSTRAINT "webhook_events_swap_id_not_null" TO "webhook_events_id_not_null";
Activity
github-actions commentedon Oct 7, 2026
Summary
On a fresh clone,
./.superset/setup.local.shcannot migrate the local Docker database, so the dev-account seed also fails withrelation "auth.users" does not exist. The code confirms both causes in the report, and they are independent. First, drizzle-kit has no TCP Postgres driver to load, so it uses@neondatabase/serverless. That driver connects over a websocket and cannot reach plain Postgres onlocalhost. Second, migration 0122 renames NOT NULL constraints by name. Postgres creates named NOT NULL constraints only from version 18, but the local compose stack runs Postgres 17.Affected code
.superset/setup.local.sh:83pointsDATABASE_URL_UNPOOLEDat direct Postgres (localhost:$LOCAL_PG_PORT). The comment at.superset/setup.local.sh:115says "migrate uses direct pg".local_migrate(:159-167) runsbun run db:migrate.package.json:57mapsdb:migratetobun run --cwd packages/db migrate, which runsdrizzle-kit migrate(packages/db/package.json:43).packages/db/drizzle.config.ts:5-11passes onlydialect: "postgresql"anddbCredentials.url. It sets nodriver, so drizzle-kit uses whichever driver package it can resolve.packages/db/package.json:47-60lists@neondatabase/serverlessand nopgorpostgres. Nopackage.jsonin the repo depends onpgorpostgres, andbun.lockhas nopg@orpostgres@entries. Neon's driver is the only one drizzle-kit can find.docker-compose.yml:3setsimage: postgres:17.packages/db/drizzle/0122_webhook_events_swap_to_short_retention.sql:74-79has sixRENAME CONSTRAINT "webhook_events_swap_*_not_null"statements. Before Postgres 18, NOT NULL is not stored as a named row inpg_constraint, so on 17 the first rename fails with "constraint does not exist".Root cause
deploy-preview.yml:90anddeploy-production.yml:53rundrizzle-kit migrateagainst real Neon, where the websocket driver works.:71-73assumes Postgres creates named NOT NULL constraints), and Neon runs 18. The local stack runs 17. Every migration up to 0121 applies on 17, and the run stops at 0122.Reproduction
bun install../.superset/setup.local.sh. drizzle-kit logsUsing '@neondatabase/serverless' driverand fails withECONNREFUSEDonCREATE SCHEMA IF NOT EXISTS "drizzle".pgresolvable frompackages/dband runbun run db:migrateagain. Migrations apply up to 0122, then fail on the firstRENAME CONSTRAINT.Or, without drizzle: on a
postgres:17container, runCREATE TABLE t_swap (id int NOT NULL); ALTER TABLE t_swap RENAME TO t; ALTER TABLE t RENAME CONSTRAINT t_swap_id_not_null TO t_id_not_null;. It errors on 17 and succeeds on 18.Fix direction
Driver: Add
pg(and@types/pg) as a devDependency ofpackages/db. Before merging, check which driver drizzle-kit 0.31 picks when bothpgand@neondatabase/serverlessare installed. If it pickspgfirst, preview and production migrations also move topgover TCP against Neon's unpooled URL. That should work, but it changes the deploy path, including how theSET LOCALtimeouts in 0122 behave. If the deploy path should stay as it is, keep thepgchange local, for example with a separate local-only config or script.Postgres version: There are two options.
docker-compose.ymltopostgres:18to match Neon. Two catches with the official 18 image:PGDATAto/var/lib/postgresql/18/dockerand expects the volume at/var/lib/postgresql. Either setPGDATA=/var/lib/postgresql/data, as the reporter did, or change the mount.superset-<workspace>_superset_db_data) hold 17 data files, which 18 will not start on. Those workspaces needdocker compose -p <project> down -vand a fresh migrate and seed. The setup script ordocs/should mention this.DOblock that checkspg_constraintfirst. This edits a committed migration underpackages/db/drizzle/, so it needs explicit maintainer sign-off. drizzle-kit records applied migrations by timestamp, so environments that already ran 0122 would not re-run it.Bumping to 18 is the cleaner fix, because later migrations may also depend on Postgres 18 behaviour.