Documentation menu

Version 1.8.0-community

Copying Without Deleting

Replicate related data to another server while leaving the source untouched.

The copy workflow writes data to the destination and leaves the source exactly as it was. Nothing is removed.

Running it

goarchive copy-only -c archiver.yaml --job archive_old_orders

When to use it

  • Populating a reporting or analytics database with a consistent slice of related data.
  • Seeding a test environment with real data that keeps its relationships intact.
  • Staging an archive in two steps β€” copy now, verify at leisure, remove later with the purge workflow.
  • Trying out a job definition against real data with no possibility of removing anything.

What happens

Discovery, ordering, batching, and verification work exactly as they do in the archive workflow. The difference is that the run ends after verification. There is no delete step.

Because nothing is removed from the source, the checks that relate specifically to deletion do not apply, and no deletion privilege is required.

Configuration

The same job definition serves every workflow. Nothing about a job is specific to copying:

jobs:
  archive_old_orders:
    root_table: orders
    primary_key: id
    where: "created_at < DATE_SUB(NOW(), INTERVAL 2 YEAR)"
    relations:
      - table: order_items
        primary_key: id
        foreign_key: order_id
        dependency_type: "1-N"

Copy now, remove later

Because the two halves are separate commands, you can put time between them:

# today β€” copy, leaving the source intact
goarchive copy-only -c archiver.yaml --job archive_old_orders

# after confirming the archive is complete and backed up
goarchive purge -c archiver.yaml --job archive_old_orders

This gives you a window to validate the archive before anything is removed. See Purging Data .

Resuming

As with every workflow, running the command again resumes an interrupted copy. Rows already copied and verified are marked complete rather than copied a second time.