---
title: "Database migrations with Geni and libSQL"
description: "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."
url: "https://swe.quest/articles/database-migrations-with-geni-and-libsql-3a27c6420a1aefca"
canonical: "https://turso.tech/blog/database-migrations-with-geni"
source: "Turso"
published: "2024-08-05"
difficulty: "medium"
kind: "How-to"
reading_minutes: 3
tags: ["schema-migrations","sqlite","ci-cd"]
---

# Database migrations with Geni and libSQL

A post on [Turso](https://swe.quest/sources/turso.md), published 2024-08-05, 3 min read, How-to. Original: [https://turso.tech/blog/database-migrations-with-geni](https://turso.tech/blog/database-migrations-with-geni)

## Summary

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.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Schema migrations](https://swe.quest/tags/schema-migrations.md) (Data & databases)
- [SQLite](https://swe.quest/tags/sqlite.md) (Data & databases)
- [CI/CD](https://swe.quest/tags/ci-cd.md) (Reliability & operations)

## Prerequisites

- SQL DDL basics ([easy posts on SQL](https://swe.quest/tags/sql.md?difficulty=easy))
- GitHub Actions ([easy posts on CI/CD](https://swe.quest/tags/ci-cd.md?difficulty=easy))

## Keywords

Geni, libSQL, Turso, SQLite, GitHub Actions

## Related posts

- [Create a database branch with GitHub Actions](https://swe.quest/articles/create-a-database-branch-with-github-actions-d979dde1d3eb17f6.md): Turso · 2024-01-18 · Medium · 5 min read · CI/CD, SQLite, Databases
  A 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.
- [Looking at How Replit Agent Handles Databases](https://swe.quest/articles/looking-at-how-replit-agent-handles-databases-9885f9639f0232ad.md): Neon · 2024-11-08 · Medium · 7 min read · Schema migrations, AI for coding, PostgreSQL, Python
  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.
- [Migrating data from MySQL to Turso](https://swe.quest/articles/migrating-data-from-mysql-to-turso-b6fe55604096d41a.md): Turso · 2024-03-08 · Medium · 2 min read · SQLite, MySQL, Schema migrations
  Moving 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\`.
- [Migrating Schemas Across Many Neon Projects Using DrizzleORM](https://swe.quest/articles/migrating-schemas-across-many-neon-projects-using-drizzleorm-bb1d354116390120.md): Neon · 2024-11-21 · Medium · 10 min read · Schema migrations, Multi-tenancy, PostgreSQL, CI/CD, JavaScript
  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.
- [How to Deploy Schema Changes to a Million Databases](https://swe.quest/articles/how-to-deploy-schema-changes-to-a-million-databases-356cdf3f01c11d17.md): Turso · 2025-06-02 · Medium · 4 min read · Schema migrations, Multi-tenancy, SQLite, Local-first & sync, Go
  Database-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.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
