Squash multiple early Drizzle migrations into one baseline migration in this repository. Use when the project is still in heavy development and you want one clean migration while preserving the current local schema state and Drizzle bookkeeping.
server/drizzle/ has several small migrations that should become one baseline migration.Collapse the current Drizzle migration chain into a single 0000_*.sql baseline plus one 0000_snapshot.json, then rewrite the local drizzle.__drizzle_migrations table so Drizzle sees the already-applied schema as matching that new baseline.
server/drizzle/server/drizzle/meta/server/drizzle.config.tsdrizzle.__drizzle_migrations in the Postgres databaseInspect the current migration chain.
server/drizzle/meta/_journal.json.server/drizzle/.server/drizzle/meta/.If the schema change also moves live data, apply that transition before squashing.
just migrate so the local database is already on the target schema before rewriting history.0000_*.sql; the squashed baseline should describe the final schema for fresh databases, not legacy transition steps.Fold the latest schema into the baseline migration.
server/drizzle/0000_*.sql so it directly creates the latest schema.CREATE TABLE constraints when possible, and keep separate CREATE INDEX statements when needed.Collapse the metadata to one baseline snapshot.
server/drizzle/meta/0000_snapshot.json.prevId in 0000_snapshot.json to 00000000-0000-0000-0000-000000000000.server/drizzle/meta/_journal.json to one entry for the 0000_* migration.Remove later migration files.
server/drizzle/0001_*.sql and above.server/drizzle/meta/0001_snapshot.json and above.Recompute the baseline migration hash.
shasum -a 256 server/drizzle/0000_*.sql.drizzle.__drizzle_migrations.hash.Rewrite the local Drizzle migration journal in Postgres.
docker compose exec -T kowalski_db psql -U kowalski_user -d kowalski -c "\d drizzle.__drizzle_migrations"TRUNCATE TABLE drizzle.__drizzle_migrations RESTART IDENTITY;INSERT INTO drizzle.__drizzle_migrations (hash, created_at) VALUES ('<new_sha256>', <journal_when_value>);Verify.
just migrate and confirm it is a no-op or succeeds cleanly.just ready.drizzle.__drizzle_migrations over dropping the DB when local data should be preserved.just clean-db followed by just migrate is a simpler fallback, but it destroys data.server/drizzle/server/drizzle/meta/drizzle.__drizzle_migrationsjust ready passes against the squashed migration history