{
  "id": 17395195,
  "title": "Generated SQL migrations for Python, TypeScript and Go projects",
  "url": "https://urgent.news/2026/10/31/generated-sql-migrations-for-python-typescript-and-go-projects",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-10-31T11:55:26.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/fsmutimeer/generated-sql-migrations-for-python-typescript-and-go-projects-2jc2"
  },
  "original_language": "en",
  "account": "Migrax was initially designed for Java, generating SQL migrations based on JPA entities. However, the concept applies to any ORM, as they all know the expected tables and can generate CREATE TABLE statements. The tool reads a schema file, compares it with the existing migrations, writes the next migration with its rollback script, and applies it. This article demonstrates the process using a Python project, Drizzle in TypeScript, and GORM in Go.\n\nExporting the schema involves creating a script that compiles the ORM models into SQL CREATE TABLE statements. This script is then used to generate the initial migration. Migrax reads its settings from environment variables, including the database URL, user, and password, as well as the locations for the migrations and schema file.\n\nDuring the first migration, Migrax sets up a throwaway PostgreSQL database in Docker, reads the schema file, and creates two tables, customers and orders, along with an index and a foreign key constraint. The rollback script is also generated. Migrax then runs the migration on the throwaway database, which validates the SQL before applying it to the production server.",
  "summary": "Migrax started as a tool for Java: it reads JPA entities and writes the SQL migrations that bring the database in line with them. But the idea doesn't depend on Java. Every ORM knows the tables it expects, and almost every ORM can print them as CREATE TABLE statements. That SQL is all Migrax needs. Keep it in a schema file, and Migrax compares it with what the existing migrations build, writes…",
  "key_points": [
    "Migrax generates SQL migrations for Python, TypeScript, and Go projects.",
    "Tool reads schema file, compares with existing migrations to create next migration.",
    "Migrax validates SQL migration on throwaway PostgreSQL database before production."
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}