Tags: webfactory/slimdump
Tags
Upgrade dependencies to latest versions available for PHP 8.1 (#108) This ensures the published `.phar` versions use the latest available versions of dependencies available today (and compatible with PHP 8.1+). At the same time, it should remove any dependency blockers users might have when installing `slimdump` as a Composer dependency alongside their projects.
Dump the character set as specified for the connection (#101) Since the `utf8` value has been deprecated in MySQL, it is advisable to append `?charset=utf8mb4` to DSNs. This change makes sure the selected character set is also written to the SQL output, since it determines the encoding in which data was received by `slimdump`.
Dump TRIGGER definitions _after_ data (#100) When the new CSV output mode with the concept of "output drivers" was added in #92, dumping `TRIGGER` definitions was made an implementation detail of the MySQL output driver. This caused `TRIGGER` definitions to be dumped right after the `CREATE TABLE ...` commands, before the actual data `INSERT` statements. This potentially breaks the generated SQL files, since a newly created trigger may be relevant for the subsequent `INSERT` statements; however, MySQL requires that tables used in the trigger are also included in the `LOCK TABLES` statements. The aim of this PR is to revert that change, i. e. to dump trigger definitions for a table _after_ the data insert statements for it. I think it is not necessary to move all trigger definitions to the very end of the output – that is, after _all_ tables have been created and filled with data: A trigger depends on insert/update/deletes for a particular table and is executed only on these events. So, it is not a problem if a trigger refers to a table that has not been created/loaded yet as long as the trigger is not run (and avoiding to run it is the aim of this PR).
Implement CSV output mode (#92) This change implements a new output mode for CSV files. The new command option `--output-csv=...` enables CSV output mode, and must be given the path to a directory. The output mode will create `.csv` files in the given directory, named according to the dumped tables. This output format does not support output redirection from `stdout` as the default MySQL SQL format does. CSV files will be created only for tables that contain data. In other words, `schema` type dumps will skip the table in question. Also, dumping views/triggers makes no sense for CSV files, they will be skipped as well. How to best write binary (BLOB) data and/or NULL values in CSV files is probably highly controversial. For now, we'll just go with the [`0x...` hex literals supported by MySQL](https://dev.mysql.com/doc/refman/8.0/en/hexadecimal-literals.html). Maybe having binary data in CSV files is not a sane idea in the first place. Co-authored-by: Matthias Pigulla <mp@webfactory.de>
PreviousNext