---
title: "Discussion on \"Writing a Postgres Seed Script That Survives the Next Migration\" | Hashnode"
description: "Discussion on \"Writing a Postgres Seed Script That Survives the Next Migration\". TL;DR: A seed script is a SQL or code file (seed.sql, seed.ts) that inserts a known set of rows into a Postgres database after migrations run. A good one orders inserts by foreign key, stays idempoten"
url: "https://hashnode.com/posts/writing-a-postgres-seed-script-that-survives-the-next-migration/6a81b9e897e88fa6891b6df7"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Writing a Postgres Seed Script That Survives the Next Migration](https://mikhail-shytsko.hashnode.dev/writing-a-postgres-seed-script-that-survives-the-next-migration?utm_source=hashnode&utm_medium=feed)

TL;DR: A seed script is a SQL or code file (seed.sql, seed.ts) that inserts a known set of rows into a Postgres database after migrations run. A good one orders inserts by foreign key, stays idempoten

Aug 16 · 15 min read · mikhail-shytsko.hashnode.dev  
Read the article

-   [#postgresql](https://hashnode.com/tag/postgresql)
-   [#databases](https://hashnode.com/tag/databases)
-   [#testing](https://hashnode.com/tag/testing)
-   [#sql](https://hashnode.com/tag/sql)

## Written by

[Mikhail Shytsko](https://hashnode.com/@mikhail-shytsko)

@mikhail-shytsko · Bratislava, Slovakia

  
[View profile](https://hashnode.com/@mikhail-shytsko)

Working on AI-native systems and scalable backend architecture. Spring and Python background.

Product-oriented engineer building AI-native systems at the intersection of scalable backend architecture and intelligent automation. Deep experience with Spring and Python ecosystems, from high-load banking microservices serving 2M+ customers to LLM-powered developer tooling. Currently building Seedfast (https://seedfa.st/), a schema-aware data generator for Postgres in compliance-sensitive environments.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
