Download the PHP package andig/dbcopy without Composer
On this page you can find all versions of the php package andig/dbcopy. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package dbcopy
dbcopy
dbcopy
is a database copy- and migration tool. It is used by the Volkszaehler project.
Setup
dbcopy
is configured via a dbcopy.json
config file. dbcopy
will look for this file in the following places if not specified using the --config
option:
- current (working) directory
- directory of
dbcopy
itself
The config file has the following structure:
The tables
section is optional. If not configured, dbcopy
will auto-discover all tables in the source schema.
Command line syntax
Create command
The create
command will copy the database schema of the source database connection to the target database. If database drivers (e.g. MySQL and SQlite) differ, the schema definition will be translated for the target platform. Limits of the underlying Doctrine/DBAL libraries apply.
Clear command
The clear
command clears all tables in the target schema by TRUNCATING them. With the --drop
option the tables are DROPPed altogether.
Drop command
Opposed to clear
, the drop
command DROPs the entire target schema if the database platforms supports it. If e.g. SQlite is used, the SQlite database file is not deleted.
Backup command
backup
is the core routine of dbcopy
. backup
executes the following steps:
- Validate source connection is working and source schema exists, same for target connection and schema.
- Obtain list of tables- either from config file or by auto-discovering table of the source schema.
- Drop foreign keys on the identified tables in the target schema. This is necessary to allow copying of data without violating referential integrity.
- Copy data table by table according to configured copy mode.
- Re-apply foreign keys on the target schema (Note: currently not implemented for performance reasons.
Influx command
The influx
command can copy data from the Volkszaehler data table into an InfluxDB measurement. This can be helpful for using Grafana or Chronograf with Volkszaehler.
With this command, the table configuration is ignored and only the data table transferred, including additional entity attributes.
Limitations
dbcopy
does not support triggers and stored procedures. No support is planned.
All versions of dbcopy with dependencies
symfony/console Version ^4.0|^5.0
influxdb/influxdb-php Version ^1.14
symfony/yaml Version ^4.|^5.0