Browse documentationOpen

byrcsc/laravel-data-sync · 1.x

Console commands.

Every Artisan command the package registers, its arguments and options, what it prints, and what its exit code means.

CommandWhat it does
sync:run [name] [--now] [--force] [--dry-run]Discover and process files
sync:status [name] [--failures] [--limit=]Recent runs, counters, batch progress
sync:retry <run> [--failed-rows]Retry a finished run, or replay its failed rows
sync:doctor [--strict]Check the installation and its dependencies
sync:pruneEnforce the retention windows
make:sync <name> [--transfer]Scaffold a definition

sync:run

php artisan sync:run
php artisan sync:run products
php artisan sync:run products --now
php artisan sync:run products --force
php artisan sync:run products --dry-run
Argument / optionEffect
nameOne registered definition. Omitted, every enabled definition runs
--nowProcess in this process instead of dispatching to the queue
--forceProcess a checksum that has already completed
--dry-runValidate and count without writing; implies in-process

Prints one line per run plus a per-definition summary of discovered, skipped, and deferred files. Exits non-zero when a definition throws — a schema mismatch, an unreachable source, an invalid definition. A definition whose discovery lock is held is reported and exits zero, because an overlapping run is a normal condition.

Details in running a sync.

sync:status

php artisan sync:status
php artisan sync:status products --limit=25
php artisan sync:status --failures
Argument / optionEffect
nameLimit history to one definition
--limit=Maximum runs to display; defaults to 10
--failuresPrint one line per failed row for the listed runs

Runs are listed newest first. For runs with a queued batch, the progress column reads the batch record. Always exits zero, including when there is no history.

Details in run history and status.

sync:retry

php artisan sync:retry 01JQ8Z3M0K2N4P6R8T0V2X4Y6A
php artisan sync:retry 412 --failed-rows
Argument / optionEffect
runA run ULID or numeric id; the run must have finished
--failed-rowsReplay only the captured failed-row payloads, in this process

Without the flag, the preserved copy of the file is restored to staging and dispatched as a new run — from the archive disk for a completed run, from the failed disk for one that failed or was cancelled.

Exits non-zero when the run is unknown or unfinished, when no stored copy remains, when payload capture was off and --failed-rows was asked for, or when --failed-rows is used on a transfer.

Details in failures and retries.

sync:doctor

php artisan sync:doctor
php artisan sync:doctor --strict
OptionEffect
--strictTreat warnings as failures

Prints each failure and warning, then a summary. Exits non-zero on any failure, or on any warning with --strict.

Details in health checks.

sync:prune

php artisan sync:prune

No arguments. Enforces the four retention windows and prints what it removed:

Pruned 412 runs, 1204 row failures, 88 archives, and 3 failed files.

Scheduled daily unless data-sync.register_schedules is false. Exits non-zero when a disk cannot be listed or a file cannot be deleted, naming the config key at fault.

Details in retention and pruning.

make:sync

php artisan make:sync ProductsSync
php artisan make:sync Products              # same class
php artisan make:sync StatementsTransfer --transfer
Argument / optionEffect
nameThe definition class name
--transferGenerate a TransferDefinition instead

Writes to app/Syncs/. The Sync or Transfer suffix is appended when absent, and the class is namespaced under the application's root namespace. Exits non-zero when the file already exists — it never overwrites.

The generated class is a skeleton pointing at User (or a local disk, for transfers). Register it in data-sync.syncs yourself; the command does not touch config.

Exit codes

Every command returns 0 on success and 1 on failure. Two behaviours are worth calling out for scripts and schedulers:

  • sync:run exits zero when discovery is locked by another invocation.
  • sync:doctor exits zero on warnings unless --strict is given, and a single-machine deployment always warns about its local staging disk.