mortezamasumi/fb-copydb

Artisan command to copy database contents between connections

Maintainers

Package info

github.com/mortezamasumi/fb-copydb

pkg:composer/mortezamasumi/fb-copydb

Transparency log

Statistics

Installs: 112

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v5.1.0 2026-08-01 05:42 UTC

This package is auto-updated.

Last update: 2026-08-01 05:43:22 UTC


README

Latest Version on Packagist GitHub Tests Action Status Total Downloads License

A Laravel artisan command that copies the contents of a source database into a destination database. It supports SQLite and MySQL connections, configurable per-connection options, chunked inserts, and legacy filament-base user column/table-name conversion.

Features

  • Copy between connections — use a connection defined in database.php or build one inline with --src_url / --dest_url
  • Automatic destination setup — creates the destination database and runs migrations (unless --no-migrate is given)
  • Chunked inserts — configurable --chunk_size (default 1000) to keep memory usage low
  • Legacy conversion — maps old filament-base user columns (account_expires_at, expired_at, mobile_verified_at) and table names (settingsfb_settings, messagesfb_message, ...)
  • Skip tables — always-ignored message/migration tables plus a --tables_except list

Installation

composer require mortezamasumi/fb-copydb

Usage

Run the copy using two existing connections:

php artisan fb-copydb --src_connection=source --dest_connection=destination

Or point directly at a remote database:

php artisan fb-copydb \
  --src_url=user:pass@host \
  --src_db=my_database \
  --dest_connection=local

When no destination is given, the application's default connection is used.

Options

Option Description
--src_connection= Source connection as defined in database.php
--src_url= Source credentials in user:pass@host format when src_connection is not set
--src_db= Source database name when src_connection is not set
--src_driver= Source driver (default mysql) when src_connection is not set
--dest_connection= Destination connection as defined in database.php
--dest_url= Destination credentials in user:pass@host format when dest_connection is not set
--dest_db= Destination database name when dest_connection is not set
--dest_driver= Destination driver (default mysql) when dest_connection is not set
--chunk_size=1000 Number of rows inserted per chunk
--tables_except= Comma-separated list of tables to skip
--no-migrate Skip dropping the destination database and running migrations

Testing

composer test

Support policy

PHP Laravel Supported
8.3 12 Yes

Contributing

Please see CONTRIBUTING for details.

Security

If you discover a security vulnerability, please review our security policy and report it privately.

Changelog

Please see CHANGELOG for more information on what has changed recently.

License

The MIT License (MIT). Please see License File for more information.