Milk Admin
Getting started
Abstracts Class
Advanced
Modules
Expressions
Extensions
Form
List
Model
Related Content
CLI Commands
Revision: 2025/10/21
MilkAdmin provides command-line tools to manage module installation, database schema updates, and other administrative tasks.
Why use CLI commands?
- Safe database migrations: Update schema without data loss
- Automated installation: Create tables and seed initial data
- Fast deployment: Run commands via SSH for quick updates
- Consistent workflow: Same commands for all modules
Command Syntax
All CLI commands follow this pattern:
php milkadmin/cli.php moduleName:command
⚠️ Important: Replace moduleName with your actual module name (case-sensitive). For example, if your module class is PostsModule, use posts.
Available Commands
1. Install Module
php milkadmin/cli.php moduleName:install
What it does:
- Creates all database tables defined in the module's Model(s)
- Executes
afterCreateTable()method to insert initial/demo data - Sets up indexes and foreign keys
When to use:
- First installation of a new module
- After downloading a module from the repository
- When you need to reset the module (drop + recreate tables)
Example:
# Install the Posts module
php milkadmin/cli.php posts:install
2. Update Module Schema
php milkadmin/cli.php moduleName:update
What it does:
- Compares the current database schema with the Model definition
- Adds new columns without losing existing data
- Modifies column types if changed in the Model
- Does NOT execute
afterCreateTable()
Example:
# Update the Posts module schema
php milkadmin/cli.php posts:update
3. List Available Commands
If you don't know what commands are available, you can list them all with:
php milkadmin/cli.php
If you lost the password of the administrator, you can create a new one with:
php milkadmin/cli.php create-administrator
Loading...