- How do I install clarkewing/legacy-sync in a Laravel application?
- Install it with Composer using composer require clarkewing/legacy-sync, then publish any package configuration and define your legacy database connection. Integration is additive: no application schema migration is indicated, so you mainly need credentials for the legacy database and a place in your service layer or a queued job to invoke the sync. Because the package is still 0.x, pin an explicit version in composer.json and review the changelog before upgrading. Check the repository README for the exact config publish command and required service provider registration.
- Which PHP and Laravel versions does clarkewing/legacy-sync support?
- The package is Laravel-native and installed via Composer, but the supported PHP and Laravel version ranges should be confirmed from its composer.json constraints before you commit to it. Check that the constraints match your application's PHP version and framework version, and confirm which legacy database drivers are supported. If you run multiple legacy connections or a non-standard driver, validate that combination in staging first. Treat any version constraint as part of your upgrade plan since 0.x releases can change behavior.
- How do I configure the legacy database connection for syncing?
- Add a dedicated connection in config/database.php pointing at the legacy system, and reference it from the package configuration. Use least-privilege credentials limited to the tables and operations the sync actually needs, especially if delete propagation is enabled. Because the legacy database is a separate connection, transactions in your Laravel app will not span both systems, so plan for partial-failure handling. Verify connection settings such as timeouts and isolation level against the legacy database's capabilities.
- What does deleteRecord() do in v0.3.0 and is it safe to use?
- deleteRecord() was added in v0.3.0 and extends the package from create and update synchronization into delete propagation, so records removed in one system can be removed in the other. It is inherently destructive and materially raises risk compared with 0.2.x, so treat it as opt-in and do not expose it directly to controllers or generic admin actions. Wrap calls behind policy checks, audit logging, and a feature flag, and confirm from the source whether it performs hard or soft deletes. Review PR #2 and the changelog for edge cases before enabling it in production.
- Does deleteRecord() respect soft deletes and Laravel model events?
- The public documentation does not clearly state whether deleteRecord() honors soft deletes, cascades, or fires model events, so verify this by reading the package source and testing in staging. If your app relies on observers for auditing or cache invalidation, confirm whether the package operates on models or directly on tables and primary keys. Where behavior is ambiguous, add your own audit logging around the call rather than depending on model events. Also check how it handles foreign-key violations and whether it runs inside a transaction.
- Can clarkewing/legacy-sync sync data in both directions?
- Yes, the package is described as providing bi-directional syncing between a legacy database and a modern Laravel application. Bi-directional sync requires a clear record-ownership and conflict-resolution model, otherwise updates and deletes can fight each other. Decide which system is authoritative for each table and document that before enabling delete propagation. If deletion only flows one way and stays limited in scope, architecture impact stays low.
- How do queued imports and incremental updates work?
- The package supports configurable mappings, queued imports, and incremental updates so you can mirror or migrate legacy data without downtime or custom scripts. Run sync work inside queued jobs rather than synchronously in requests, and add batching, throttling, and job timeouts to avoid connection saturation on the legacy database. Incremental updates let you avoid full re-imports, which is important for large legacy tables. Wrap the package calls in your own service class so any future API changes are isolated to one place.
- Is clarkewing/legacy-sync safe to use in production?
- It can be, but deletion is destructive and the package is still a 0.x release, so treat API stability cautiously and pin the version. Rehearse backup and restore, validate against sanitized legacy data in staging, and add a feature flag plus audit logging before enabling deletes for real records. Test missing-record, foreign-key, timeout, and partial-failure scenarios, and implement a dry-run or confirmation wrapper for destructive paths. Only expand to additional record types after read and update sync have proven stable in production.
- How should I test deletion and sync behavior before going live?
- Start with a restorable backup, then run the sync and delete paths against sanitized legacy data in a staging environment that mirrors production connections. Cover idempotency when a record is already missing, foreign-key violations, cascades, timeouts, and failure after a remote commit. Confirm whether deleteRecord() returns a result or throws so your error handling is correct. Bulk or cascading deletes deserve dedicated tests because they can cause lock contention and long transactions.
- What are the alternatives to clarkewing/legacy-sync and is it well maintained?
- It is a small, community and maintainer-led 0.x package, so support may be limited and you should define an internal owner for it. Alternatives include writing your own sync jobs, using a full ETL or replication tool, or database-level replication if your legacy engine supports it. If you keep the package, pin the version, track upstream changes, and isolate calls behind an internal service so you can swap implementations later. Establish an escalation path and read the source for delete semantics before relying on it for production data changes.