nself migrate
nself migrate — ɳSelf documentation.
Detect and migrate legacy nSelf artifacts to the current CLI version.
Synopsis
nself migrate [subcommand] [flags]
Description
nself migrate helps you upgrade an existing ɳSelf v1 project to v2, migrate legacy v0.9.9 Bash-era projects, and import a schema from Firebase or Supabase. Running nself migrate without a subcommand performs a detection scan, the same as nself migrate detect: and reports which v1 artifacts are present and what needs to change.
The run subcommand performs the full automated v1→v2 migration: it stops running containers, backs up the current project state to .nself/backup/{timestamp}/, moves nginx configs to the v2 directory layout, regenerates docker-compose.yml, nginx, and SSL certificates, and prints a summary of every change made. The migration is idempotent, running it on an already-v2 project exits cleanly with no changes.
If anything goes wrong, use nself migrate rollback to restore from the most recent backup.
generate and watch use the nSelf AI plugin to propose SQL migration files from a natural-language description or from model-file changes (additive-only guard; never emits DROP/TRUNCATE/DELETE without a warning comment; you still run nself db migrate up to apply). firebase and supabase generate nSelf-compatible migration artifacts (schema SQL, Hasura metadata, auth import) from an exported Firebase project or a live Supabase project. from-bash guides migration from a v0.9.9 Bash-era project layout.
Note:
nself migratemanages project/schema migration tooling. For applying migrations to the database, see cmd-db (nself db migrate).
Subcommands
| Subcommand | Description |
|---|---|
detect |
Detect v1 artifacts in the current project (alias for default scan) |
run |
Full v1→v2 migration: stop containers, backup, move configs, regenerate |
rollback |
Restore from the most recent migration backup |
from-bash |
Migrate a v0.9.9 Bash-era project to the current nSelf CLI |
firebase |
Generate nSelf migration artifacts from a Firebase Firestore/Auth export |
supabase |
Migrate a Supabase project’s schema, data, auth, and storage to nSelf |
generate <description> |
Generate a SQL migration from a natural-language description (via the AI plugin) |
watch |
Watch model files (TS/Go/Dart) and propose SQL migrations on change |
Flags
| Flag | Default | Description |
|---|---|---|
--from-bash |
false | Migrate from a v0.9.9 Bash-era project (alias for nself migrate from-bash) |
--backup |
"" |
Specific backup timestamp to restore (for rollback, e.g. 20260328-143022) |
--list |
false | List available backups with timestamps and sizes (for rollback) |
--auto |
false | Run automatable migration steps after confirmation (for from-bash) |
--export-dir |
"" |
Path to a Firebase JSON export directory (for firebase) |
--project-ref |
"" |
Supabase project reference (for supabase) |
--supabase-key |
"" |
Supabase service_role key (for supabase) |
--ai-endpoint |
http://localhost:3001 |
nSelf AI plugin endpoint (for generate, watch) |
--help, -h |
none | Show help |
Examples
# Scan for v1 artifacts
nself migrate
nself migrate detect
# Perform the v1→v2 migration
nself migrate run
# Restore from the most recent backup
nself migrate rollback
# List available backups
nself migrate rollback --list
# Restore from a specific backup
nself migrate rollback --backup 20260328-143022