Overview
Thegeni status command displays which migrations are pending (not yet applied) to your database. This helps you understand what changes will be made before running geni up.
Usage
With Verbose Flag
Flags
Include the full SQL content of pending migrations in the output.Aliases:
-vDefault behavior: Only shows migration timestamps/namesWith flag: Shows timestamps/names and complete SQL contentRequired Environment Variables
The database connection string. Format varies by database type.Examples:
- PostgreSQL:
postgres://user:password@localhost:5432/dbname?sslmode=disable - MySQL:
mysql://root:password@localhost:3306/app - MariaDB:
mariadb://root:password@localhost:3307/app - SQLite:
sqlite://./database.sqlite - LibSQL:
https://localhost:6000
Optional Environment Variables
Authentication token for LibSQL/Turso databases.
Path to the directory containing migration files.
Name of the table used to track applied migrations.
Filename for the database schema file.
Number of seconds to wait for the database to be ready.
How It Works
- Connect to the database
- Read the migrations tracking table to get applied migrations
- Scan the migrations folder for
.up.sqlfiles - Compare local migration files with applied migrations
- Display migrations that exist locally but not in the database
Examples
Basic Status Check
Verbose Status
Show the complete SQL content of pending migrations:SQLite Example
MySQL Example
LibSQL/Turso Example
Custom Configuration
Understanding the Output
Pending Migrations
Each line starting with “Pending” indicates a migration that exists in your migrations folder but hasn’t been applied to the database:No Output
Ifgeni status produces no output, your database is up to date:
Verbose Mode Details
With--verbose, you see:
- Migration identifier: The timestamp/name
- SQL content: The complete contents of the
.up.sqlfile
Use Cases
Pre-Deployment Check
Verify what migrations will run before deploying:Development Workflow
Check migration status during development:CI/CD Validation
Validate migrations in CI before applying them:Code Review
Review pending migrations with verbose output:Comparing Environments
Check migration status across different environments:Integration Examples
Bash Script
Make Command
Docker
CI/CD Integration
GitHub Actions
GitLab CI
Error Handling
No Migrations Folder
DATABASE_MIGRATIONS_FOLDER correctly.
Connection Failed
DATABASE_URL environment variable.
Migration Table Doesn’t Exist
If the migrations tracking table doesn’t exist,geni status will create it automatically and show all migrations as pending.
Interpreting Results
All Migrations Applied
Some Migrations Pending
geni up.
Database Behind Local
If you see many pending migrations, your database might be significantly behind:Best Practices
- Check before applying: Always run
geni statusbeforegeni up - Use in CI/CD: Integrate status checks into your deployment pipeline
- Review with verbose: Use
-vto review SQL before applying in production - Document in PRs: Include
geni status -voutput in pull requests - Compare environments: Regularly check that staging and production are in sync
- Monitor drift: If environments show different pending migrations, investigate
Next Steps
Apply Migrations
Run pending migrations with
geni upCreate Migration
Create new migrations with
geni newRollback
Rollback migrations with
geni downDump Schema
Export database schema with
geni dump