Welcome to Jetbase π
Jetbase is a simple, lightweight database migration tool for Python projects.
Jetbase helps you manage database migrations in a simple, version-controlled way. Whether youβre adding a new table, modifying columns, or need to undo a change, Jetbase makes it super easy!
Key Features β¨
- π¦ Simple Setup β Get started with just one command
- β¬οΈ Easy Upgrades β Apply pending migrations with confidence
- β¬οΈ Safe Rollbacks β Made a mistake? No problem, roll it back!
- π Clear Status β Always know which migrations have been applied and which are pending
- π Migration Locking β Prevents conflicts when multiple processes try to migrate
- β Checksum Validation β Detects if migration files have been modified
- π Repeatable Migrations β Sβ¦
Welcome to Jetbase π
Jetbase is a simple, lightweight database migration tool for Python projects.
Jetbase helps you manage database migrations in a simple, version-controlled way. Whether youβre adding a new table, modifying columns, or need to undo a change, Jetbase makes it super easy!
Key Features β¨
- π¦ Simple Setup β Get started with just one command
- β¬οΈ Easy Upgrades β Apply pending migrations with confidence
- β¬οΈ Safe Rollbacks β Made a mistake? No problem, roll it back!
- π Clear Status β Always know which migrations have been applied and which are pending
- π Migration Locking β Prevents conflicts when multiple processes try to migrate
- β Checksum Validation β Detects if migration files have been modified
- π Repeatable Migrations β Support for migrations that run on every upgrade
Quick Start πββοΈ
Installation
Using pip:
pip install jetbase
Using uv:
uv add jetbase
Initialize Your Project
jetbase init
cd jetbase
This creates a jetbase/ directory with:
- A
migrations/folder for your SQL files - An
env.pyconfiguration file
Configure Your Database
Edit jetbase/env.py with your database connection string (currently support for postgres and sqlite):
PostgreSQL example:
sqlalchemy_url = "postgresql+psycopg2://user:password@localhost:5432/mydb"
SQLite example:
sqlalchemy_url = "sqlite:///mydb.db"
Create Your First Migration
jetbase new "create users table"
This creates a new SQL file like V20251225.120000__create_users_and_items_tables.sql.
Tip: You can also create migrations manually by adding SQL files in the
jetbase/migrationsdirectory, using theV<version>__<description>.sqlnaming convention (e.g.,V1__add_users_table.sql,V2.4__add_users_table.sql).
Write Your Migration
Open the newly created file and add your SQL:
-- upgrade
CREATE TABLE users (
id SERIAL PRIMARY KEY,
name VARCHAR(100) NOT NULL,
email VARCHAR(255) UNIQUE NOT NULL
);
CREATE TABLE items (
id SERIAL PRIMARY KEY,
name VARCHAR(100) NOT NULL
);
-- rollback
DROP TABLE items;
DROP TABLE users;
Apply the Migration
jetbase upgrade
Thatβs it! Your database is now up to date. π
Note: Jetbase uses SQLAlchemy under the hood to manage database connections. For any database other than SQLite, you must install the appropriate Python database driver. For example, to use Jetbase with PostgreSQL:
pip install psycopg2
You can also use another compatible driver if you prefer (such as asyncpg, pg8000, etc.).
Supported Databases
Jetbase currently supports:
- β PostgreSQL
- β SQLite
Need Help?
Open an issue on GitHub!