Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Neon 7 min read How-to mediumAdept

How To Maintain Seed Files (And Why You May Not Want To Do It)

Seed files should be versioned alongside schema changes, executed automatically in pipelines, split by environment, made incremental like migrations, and written to be idempotent, with Ruby/Rails and Docker Compose examples showing each practice. As data grows, seeds bring maintenance overhead, drift between environments and foreign-key ordering complexity. FactoryBot factories address much of this for tests but don't suit curated demo or production initialization. Copy-on-write database branching is pitched as the alternative: full data-and-schema branches for realistic debugging and performance testing, or schema-only branches populated with seeds, synthetic or sanitized data.

Related posts

  • Database testing with fixtures and seeding

    Neon mediumAdept

    Seeding and fixtures solve different problems when populating databases for testing. Static seeds load fixed, version-controlled, idempotent reference data an app needs to run (admin users, countries and states), shown with Django scripts and Rails `db:seed`. Dynamic seeds generated with Faker supply large or randomized datasets for load and edge-case testing. Fixtures are framework-integrated, per-test datasets (e.g. Django YAML fixtures loaded in TestCase) that are set up and torn down around each test. Neon's database branching is pitched as a complement for isolated, resettable test environments.

  • Postgres for Ephemeral Environments: A Method to Keep Data Persistent

    Neon easyNovice

    Neon branches, which are copy-on-write clones of a Postgres database, can provide pre-seeded databases for ephemeral PR environments. Because a branch references the parent's data pages instead of copying them, it is created in seconds whatever the dataset size. Persistent dev and test environments suffer from configuration drift, seed-data maintenance, shared-environment conflicts and idle cost. Ephemeral environments fix most of this but still stall on loading seed data into each database. The proposed workflow keeps sanitized seed data in one main branch and has GitHub Actions create a child branch per pull request, reset it from the parent when needed and delete it on merge, with scale-to-zero limiting cost.

  • Test Your Database Without Mocks

    Neon mediumAdept

    Database mocks are brittle, expensive to maintain, and test little beyond the mock itself, since they skip real behaviour like transactions, isolation levels, foreign keys and referential integrity. The usual reasons to mock, isolation and speed, are better served by copy-on-write database branches than by test containers, which bring resource overhead, port conflicts, cleanup and CI orchestration problems. Neon branches give each developer, test suite or pull request an isolated Postgres copy with real data, created via neonctl or a GitHub Action, optionally from a point in time for debugging. Shared storage and scale-to-zero compute keep the cost low.

  • How We’re Building Git for Infrastructure

    Railway mediumAdept

    Railway's Changesets let teams fork an infrastructure environment like a Git branch, record each config or service change as a changeset, and merge it back into the parent environment. Instead of storing Git-style parent pointers (too many sequential queries) or rebuilding the tree in memory (too memory-heavy), each changeset has a single original environment and an ordering id from a PostgreSQL serial column, and each environment records its parent and fork point, so a diff is one simple query. The scope was deliberately limited to fork-and-merge-into-parent, with no arbitrary environment merges or merge requests. Tests use a Mermaid gitGraph-like DSL helper that can also print a Mermaid diagram of the test state for visual debugging.

  • Adopting Neon branching in CI/CD pipelines: a practical story by Shepherd

    Neon mediumAdept

    Shepherd, an insurtech startup that moved its Alchemist pricing engine from SQLite to Postgres, uses Neon's copy-on-write database branches to give every pull request an ephemeral test database. GitHub Actions call the Neon API to create a branch when a PR opens and delete it on merge. Changes then flow from per-developer and per-PR branches to staging and production, with Render pre-deploy commands applying migrations tracked in a dedicated timestamped table. The team credits branching with removing the cost and effort of keeping test instances synced with production, and notes that scale-to-zero means it no longer pays for idle databases.

The quest for software engineering knowledge.

Look:
Layout: