7.7 Console Commands
KMP provides several CLI commands for database management, data migration, and scheduled maintenance tasks. All commands are run via bin/cake from the application root.
Note:
AgeUpMembersCommand(documented in 3.8) andSyncActiveWindowStatusesCommand(documented in 3.7) are covered in their respective sections.
Commands
generate_public_ids
Generates unique public IDs for existing database records that are missing them.
bin/cake generate_public_ids [tables...]
bin/cake generate_public_ids --all
Arguments:
tables— One or more table names to process (e.g.,members,gatherings)
Options:
| Option | Description |
|——–|————-|
| -a, --all | Process all tables that have a public_id column |
| -f, --field | Public ID field name (default: public_id) |
| -l, --length | ID length (default: 8) |
| -d, --dry-run | Preview changes without writing to database |
When to use: After adding the PublicIdBehavior to a table, or during data migration when existing records need public IDs backfilled.
migrate_award_events
One-time migration command that converts legacy Award Events to the new Gatherings system.
bin/cake migrate_award_events
bin/cake migrate_award_events --dry-run
Options:
| Option | Description |
|——–|————-|
| --dry-run | Preview changes without modifying the database |
Migration Steps:
- Creates a “Kingdom Court” activity
- Associates awards with the activity
- Creates a gathering type for courts
- Creates gatherings from existing events
- Adds the Kingdom Court activity to each gathering
- Updates award recommendations to reference gatherings instead of events
When to use: One-time data migration from the old award events system to the new gatherings system. Should only be run once.
reset_database
Drops and recreates all database tables. Destructive operation — development only.
bin/cake reset_database
Safety: Only works when debug mode is enabled. Will not run in production.
When to use: Development environments when you need a completely fresh database state. Supports MySQL, PostgreSQL, SQLite, and SQL Server.
sync_member_warrantable_statuses
Recomputes warrant eligibility flags for members whose records have changed recently.
bin/cake sync_member_warrantable_statuses
bin/cake sync_member_warrantable_statuses --dry-run
Options:
| Option | Description |
|——–|————-|
| -d, --dry-run | Preview status changes without saving |
Behavior: Checks members modified in the last 24 hours or with stale warrantable flags, recalculates eligibility, and persists only changed values.
When to use: Scheduled via cron (e.g., daily) to keep member warrant eligibility accurate as membership status, background checks, and age data change.
update_database
Runs database migrations in the correct dependency order.
bin/cake update_database
bin/cake update_database --plugin Officers
Options:
| Option | Description |
|——–|————-|
| -p, --plugin | Run migrations for a specific plugin only |
Execution Order:
- Clears schema cache
- Runs core framework migrations
- Runs plugin migrations in configured
migrationOrderfromconfig/plugins.php
When to use: After pulling code changes that include new migrations, or as part of the deployment workflow.
Scheduling
Several commands are designed for scheduled execution via cron:
| Command | Recommended Schedule | Purpose |
|---|---|---|
sync_active_window_statuses |
Every 15 minutes | Transition entity statuses based on date windows |
sync_member_warrantable_statuses |
Daily | Recompute member warrant eligibility |
age_up_members |
Daily | Update member age calculations |
See cronScripts/ in the project root for example cron configurations.