Database CLI

Run migrations, seeding, rollbacks, and backups from the command line. Included in strata/database.

Note: Strata doesn't ship with a php strata command yet. All CLI tools are in /bin/ and provided by individual modules.

Migration Commands

Run from your project root:

php bin/migrate.php                # Apply all new migrations
php bin/rollback.php 2             # Roll back last 2 migrations
php bin/migration_status.php       # Show applied/pending migrations
php bin/create_migration.php AddUsersTable   # Scaffold new migration + .down.php

Migration locking prevents concurrent runs. Each migration tracks applied_by and applied_at.

Seeding Commands

php bin/seed.php                   # Run all seeds in seeds/
php bin/seed.php --down            # Remove seeded data

See Database → Seeding for how to write seeders.

Backup Command

Create a full database dump:

php bin/backup.php                 # Dumps to storage/backups/db-YYYY-MM-DD.sql
php bin/backup.php --gzip          # Dumps compressed to .sql.gz

Backups use mysqldump if available, with PDO fallback. Stored in storage/backups/. Add that dir to .gitignore.

Dev Server

Strata has no built-in server command. Use PHP's built-in server:

php -S localhost:8000 -t public_html

Or point your vhost to /public_html for Apache/Nginx.

Future: strata/cli

A strata/cli module with php strata make:controller is planned but not released. For now, create controllers/models manually or use your IDE’s scaffolding.