Database migrations with Geni and libSQL
Geni is a lightweight CLI that manages schema changes as paired up/down SQL files, applying each migration inside a transaction so a failed migration leaves the database unchanged. The walkthrough covers installing Geni, pointing it at a Turso/libSQL database (or a local SQLite file) via DATABASE_URL and DATABASE_TOKEN, creating and applying migrations, rolling back with `geni down`, and checking status. It closes with a GitHub Actions workflow that applies migrations automatically on pushes to main.
Related posts
- Create a database branch with GitHub Actions
Turso mediumAdeptA GitHub Actions workflow triggered on branch creation can call the Turso Platform API to seed a new database from an existing one, giving each Git branch its own isolated database. The workflow stores the API token, organization, group and source database name as repository secrets and names the new database after `github.ref_name`. It uses `curl -f` with exit-code checks to fail the job on API errors, then extracts the returned Hostname with `jq` and exports it to `GITHUB_ENV` for later steps such as deployments. Branch names must contain only lowercase letters, numbers and hyphens to be valid database names, and the official `tursodatabase/create-database-action` wraps the same logic.
- Looking at How Replit Agent Handles Databases
Neon mediumAdept
Replit Agent can keep a Flask app's code and its Neon-hosted Postgres schema in sync by generating Alembic migrations from SQLAlchemy model changes, with a little prompting to use Alembic. A TODO app is built and extended through natural-language prompts. Adding a due date and then a priority field each produces a separate migration file with upgrade and downgrade functions. Rolling back a feature runs the downgrade script, which removes both the UI change and the database column.
- Migrating data from MySQL to Turso
Turso mediumAdeptMoving a MySQL database to Turso takes three commands: dump it with mysqldump using --skip-extended-insert, convert the dump to a SQLite file with the mysql2sqlite script piped into sqlite3, then create a Turso database from that file with `turso db create --from-file`. Row counts can be checked with the sqlite3 shell after conversion and with `turso db shell` after import. Larger migrations may hit issues that need extra help.
- Migrating Schemas Across Many Neon Projects Using DrizzleORM
Neon mediumAdept
Database-per-tenant setups need every tenant database kept on the same schema, and this walkthrough automates that across many Neon projects with DrizzleORM, the Neon API and GitHub Actions. A create script provisions a Neon project per customer. A generate script lists all projects, writes a per-tenant drizzle.config.ts, runs drizzle-kit generate, stores each connection string as an encrypted GitHub secret, and rewrites the workflow YAML to expose those secrets. A migrate script, triggered when a PR is merged to main, runs drizzle-kit migrate against every config so schema changes reach all tenants.
- How to Deploy Schema Changes to a Million Databases
Turso mediumAdeptDatabase-per-tenant schema migrations can scale to millions of databases by inverting control: a hosted schema registry stores a versioned catalog of SQL scripts, and each client periodically reports its schema version, pulls the missing migrations and applies them locally. The registry needs only a simple migrations table, with no per-tenant state or distributed locks. Check-in timing (before critical operations, daily, or on user workflows) trades consistency against performance. The pull model suits offline-first apps that reconnect several versions behind, and a proof-of-concept is written in Go with SQLite.