Artisan Commands Reference

Complete reference for all available Artisan commands provided by HkDevs CodeForge Database Studio. Use these commands to manage your database operations efficiently.

Commands Overview

Installation

Setup and asset management

Migration

Enhanced migration controls

Health

Monitoring and metrics

Schema

Documentation and snapshots

Seeding

Data generation and seeding

Maintenance

Cleanup and utility commands

Quick Access

To see all available CodeForge commands, run:

php artisan list codeforge

Installation & Assets

codeforge:install

Install and configure the CodeForge Database Studio plugin with comprehensive setup validation.

php artisan codeforge:install [options]

Options:

  • --force - Force overwrite existing files

Features:

  • Configuration publishing
  • Migration execution
  • Asset publishing
  • Setup validation

codeforge:assets

Manage CodeForge Database Studio published assets (remove, publish, or refresh).

php artisan codeforge:assets {action} [options]

Actions:

  • remove - Remove published assets
  • publish - Publish assets
  • refresh - Remove and republish

Options:

  • --config - Manage config files only
  • --migrations - Manage migrations only
  • --views - Manage views only
  • --assets - Manage CSS/JS assets only
  • --force - Force overwrite when publishing
  • --dry-run - Preview without executing

Migration Commands

codeforge:migrate

Enhanced migration command with safety features, detailed logging, and rollback capabilities.

php artisan codeforge:migrate [options]

Options:

  • --rollback - Rollback migrations
  • --refresh - Refresh migrations
  • --reset - Reset migrations
  • --step=N - Number of migrations to rollback
  • --path=PATH - Path to migration files

Safety Features:

  • Enhanced tracking
  • Detailed logging
  • Rollback support
  • Error handling

codeforge:batch-migrate

Run each migration file in its own separate batch for better control and rollback granularity.

php artisan codeforge:batch-migrate [options]

Options:

  • --dry-run - Preview without executing
  • --force - Force in production
  • --fresh - Drop tables and re-run in batches
  • --path=PATH - Custom migration path

Benefits:

  • Individual rollback
  • Better tracking
  • Error isolation
  • Granular control

codeforge:sync-migration-history

Synchronize migration history and cleanup orphaned entries from the migrations table.

php artisan codeforge:sync-migration-history [options]

Options:

  • --cleanup - Also cleanup orphaned entries

Features:

  • History synchronization
  • Orphan cleanup
  • Data validation
  • Integrity checks

Health & Monitoring Commands

codeforge:collect-metrics

Manually collect database performance metrics and health statistics.

php artisan codeforge:collect-metrics [options]

Options:

  • --connection=NAME - Specific database connection

Metrics Collected:

  • Performance metrics
  • Connection statistics
  • Query performance
  • Resource usage

codeforge:toggle-query-logging

Enable or disable query logging for performance monitoring and debugging.

php artisan codeforge:toggle-query-logging [options]

Options:

  • --disable - Disable query logging
  • --enable - Enable query logging

Features:

  • Query tracking
  • Performance analysis
  • Debug assistance
  • Performance insights

Schema & Documentation Commands

codeforge:create-snapshot

Create a comprehensive snapshot of your current database schema for version control and deployment tracking.

php artisan codeforge:create-snapshot [options]

Options:

  • --name=NAME - Custom snapshot name
  • --description=TEXT - Custom description
  • --connection=NAME - Database connection
  • --baseline - Mark as baseline snapshot

Captures:

  • Table structures
  • Relationships
  • Indexes and keys
  • Constraints

codeforge:generate-docs

Generate comprehensive database documentation in multiple formats with customizable scope and styling.

php artisan codeforge:generate-docs [options]

Options:

  • --format=TYPE - Output format (markdown, html, pdf)
  • --scope=SCOPE - Documentation scope
  • --title=TITLE - Custom title
  • --description=TEXT - Custom description
  • --tables=TABLE1,TABLE2 - Specific tables
  • --output=FILE - Custom filename
  • --auto-download - Auto-download file

Documentation Features:

  • Schema documentation
  • Model relationships
  • Usage statistics
  • Multiple formats

Data Seeding Commands

codeforge:run-seeders

Execute data seeders through the CodeForge Studio with intelligent execution control.

php artisan codeforge:run-seeders [options]

Options:

  • --auto - Run only auto-run seeders
  • --seeder=NAME - Run specific seeder by name
  • --class=CLASS - Run specific seeder by class name
  • --dry-run - Preview without executing

Features:

  • Execution tracking
  • Error handling
  • Progress reporting
  • Rollback support

codeforge:generate-data

Generate intelligent test data for database tables with context-aware patterns.

php artisan codeforge:generate-data {table} [options]

Options:

  • --count=N - Number of records (default: 10)
  • --template=NAME - Use specific template
  • --preview - Preview without inserting
  • --save-template=NAME - Save as template

Smart Features:

  • Context-aware data
  • Relationship integrity
  • Template system
  • Realistic patterns

codeforge:diagnose-seeders

Diagnose seeder configuration and execution issues with detailed analysis.

php artisan codeforge:diagnose-seeders [options]

Options:

  • --seeder=NAME - Diagnose specific seeder
  • --auto - Check only auto-run seeders
  • --failed - Check only failed seeders

Diagnostics:

  • Configuration validation
  • Error analysis
  • Performance review
  • Fix suggestions

Additional Seeding Commands

Additional utilities for seeder management and debugging.

Available Commands:

  • codeforge:debug-discovery - Debug seeder discovery
  • codeforge:fix-seeder-paths - Fix seeder path issues
  • codeforge:test-generation - Test data generation

Use Cases:

  • Discovery issues
  • Path problems
  • Generation testing

Maintenance Commands

codeforge:cleanup-logs

Clean up old query logs, execution logs, and temporary data files.

php artisan codeforge:cleanup-logs [options]

Options:

  • --days=N - Keep data for N days (default: 30)
  • --dry-run - Show what would be cleaned

Cleanup Types:

  • Query logs
  • Execution logs
  • Performance metrics
  • Temporary files

codeforge:cleanup-docs

Cleanup old documentation files and records from the system.

php artisan codeforge:cleanup-docs [options]

Options:

  • --days=N - Remove files older than N days (default: 30)
  • --failed-only - Only remove failed generations
  • --dry-run - Preview without deleting
  • --force - Force deletion without confirmation

Features:

  • Documentation cleanup
  • Database record cleanup
  • Safe deletion
  • Preview mode

Powerful Command Line Interface

CodeForge Database Studio provides comprehensive command-line tools for database management, from installation to maintenance. All commands include detailed help and safety features.