Revision history for Perl extension DBIx::Admin::BackupRestore.
1.20 2021-02-06T15:52:00
- Add the boolean module to the list of modules required for testing,
after receiving many failure reports from CPAN testers.
1.19 2021-02-05T17:19:00
- Add t/02.io.t and t/03.empty.t.
1.18 2021-02-04T10:26:00
- Adopt new repo structure. See
http://savage.net.au/Ron/html/My.Workflow.for.Building.Distros.html.
- Reformat Makefile.PL.
- Explicitly specify the license is perl.
- Add t/00.*.
- Update Makefile.PL and POD to change RT to github.
1.17 2010-08-25T11:44:00
- Add a note to the FAQ in the POD about the code's failure to handle fields
containing newlines.
- Add a note to the FAQ in the POD about the XML parser's failure to handle text
containing closing tags.
- These 2 notes were suggested by John D Groenveld.
- Reformat long lines in this file, and in the POD.
1.16 2010-02-21T12:54:51
- Remove text 'All rights reserved' (for Debian licensing).
- Remove POD heads 'Required Modules' and 'Changes'.
- Replace personal doc root with /var/www.
- Use namespace::autoclean with Moose.
1.15 2010-02-10T14:01:40
- Update MANIFEST.SKIP. Add MANIFEST and MYMETA.yml.
1.14 2009-11-13T13:20:00
- Run dos2unix
- Rename Changes.txt to CHANGES
1.13 2008-07-09T09:59:00
- Retry specifying a minimum version of Perl in Makefile.PL, using different syntax.
Thanx to David Golden for the suggestion
1.12 2008-07-07T10:21:00
- Patch Build.PL and Makefile.PL to specify the required version of Perl,
since the code inside module, 'require 5.005_62;', is not enough to stop
the great CPAN testers using 5.005_05
- Reformat Build.PL and Makefile.PL slightly now that I'm using emacs
- Ship Configlog.ini
1.11 2006-08-13T18:20:00
- 'fiddle_timestamp' now takes one of these values: 0, 1 or 2, or any of those
values + 128.
The 128 means the top (left-most) bit in the byte value of this parameter is set.
If the top bit is set, another fiddle takes place, after any of the above have
occurred:
The timestamp is checked against 1970-01-01 00:00:00, and if they match, the
timestamp is changed to 1970-01-01 00:00:01. This extra second means the
timestamp is now valid under the strict option for MySQL V 5, whereas
1970-01-01 00:00:00 is invalid.
1.10 2006-05-17T11:34:00
- Patch to handle the case where the table has 1 row, and XML::Records then
does not return an array ref
1.09 2006-02-09T15:53:00
- Fix broken method restore_in_order()
- Add support for exporting from Oracle by adding 4 new parameters to new():
o dbi_catalog
o dbi_schema
o dbi_table
o dbi_type
These are actually used in the call to DBI's table_info() method.
Usage:
o MySQL: The default values of these parameters Just Work
o Oracle: Set dbi_schema to the uc(username) used when you called DBI's
connect() method
o Postgres: Set dbi_schema to 'public'
- Importing into Oracle does not handle sequences at all
- Switch from DBI's table() method to table_info(). This is for Oracle
- Discard table names which match /^BIN\$.+\$./. This is for Oracle
- Change the handling of quotes around schema and table names. Previously,
the first and last quote was removed, so a name like `public.t` became
public.t. But with Oracle, quotes are used around the schema and table
names separately, so "X"."T" became X"."T :-(.
Now, all quotes are removed, so `public.t` still becomes public.t, but also
"X"."T" becomes X.T.
1.08 2005-07-19T10:45:00
- The previous patches did not include sub backup() calling sub process_table()
to split the schema name off from the table name, so table names with schema
names still attached were not being skipped. Big mistake. My aplologies
- Add XML::Parser, XML::Records and XML::TokeParser to Build.PL and Makefile.PL.
They should have been included since V 1.06
1.07 2005-06-28T13:41:11
- The default behaviour of this version is the same as for previous version,
so there is no need to upgrade unless you need the new features.
- Fix bug whereby sub backup could output <row></row> because all columns
in a row were null, & sub restore couldn't cope.
- Document that all spaces are converted to underscores in table and column names.
- New options:
o The value of the database handle attribute FetchHashKeyName governs
how table names are handled. Values are:
'NAME': The default - use the value returned by the database server
'NAME_uc': Convert table names to upper case
'NAME_lc': Convert to lower case. This is the recommended value
This possible conversion of the case of table names affects how you
specify table names in the constructor options:
- rename_columns
- rename_tables
- skip_tables
The following new options can be passed to the constructor of this module.
o croak_on_error => 0 or 1. 1 is the default, for backwards compatibility.
During backup(), the $sth -> execute() is now wrapped in eval{}, and if
an error occurs, and croak_on_error is 1, we Carp::croak.
If croak_on_error is 0, we continue. Not only that, but if verbose is 1,
the error is printed to STDERR.
o odbc => 0 or 1. 0 is the default.
During backup, if odbc is 1 we use the simplified call $dbh -> tables()
to get the list of table names. This list includes what MS Access calls
Queries, which are possibly equivalent to views. MS Access does not
support the syntax used in the non-ODBC situation:
$dbh -> tables('%', '%', '%', 'table').
o rename_columns => {}. You can specify a hash ref in the form:
rename_columns => {'old name' => 'new name', ...}.
For example, 'order' is a reserved word under MySQL, so you would use:
rename_columns => {order => 'orders'} (or whatever you want).
The option affects all tables.
The database handle attribute FetchHashKeyName affects this option.
Renaming takes place after the effect of FetchHashKeyName.
o rename_tables => {}. You can specify a hash ref in the form:
rename_tables => {'old name' => 'new name', ...}.
The database handle attribute FetchHashKeyName affects this option.
Renaming takes place after the effect of FetchHashKeyName.
- Add method get_column_names(). This returns a hash ref, where the keys are
table names, possibly transformed according to the database handle attribute
FetchHashKeyName, and the values are array refs of column names, also converted
according to the aforesaid and understated FetchHashKeyName. Further, these
column names are sorted, and all spaces in column names are converted to
underscores.
This hashref is acceptable to the module DBIx::Admin::CreateTrivialSchema :-).
- The demo examples/backup-db.pl contains a list of MS Access tables which you
almost certainly want to supply to the skip_tables option if exporting
from MS Access.
1.06 2005-05-20T15:45:00
- Correct docs discussing the value 2 for the fiddle_timestamp option, which said
timestamp and should have said datetime.
- Add an FAQ to the docs
- Add method restore_in_order(), which lets you specify the order in which tables
are restored. This allows you to define a column with a clause such as
'references foreign_table (foreign_column)', and to populate the foreign_table
before the dependent table.
But mutually-dependent and self-referential tables are still not catered for.
- Add method split(), which reads an XML file output by backup() and splits out into
a separate file each table you are not skipping. The file names are the tables'
names, including schema if any, and with an extension of 'xml'. The output files
have headers and footers so they are identical in structure to the file output
by backup(). Hence they can be fed back in to restore() and restore_in_order().
This method helps circumvent the drawback of restore_in_order(), which reads its
input file once per table.
Since this is a file-to-file operation, the dbh parameter to new() is no longer
mandatory.
See examples/split-xml.pl and all-tables.xml for a demo.
- Change methods backup(), restore() and the new restore_in_order() and split(),
to use lower case XML tags 'dbi', 'resultset', and 'row', as they should have
been in the first place.
- Methods restore() and split() will read a file containing upper or lower case
tags.
- Warning: restore_in_order() only handles lower case tags, due to the way
XML::Records works.
- This module now requires these modules, installed in this order:
o XML::Parser
o XML::TokeParser
o XML::Records
1.05 2005-04-15T09:34:00
- Add another value to the range accepted by the option fiddle_timestamp.
This option is only used when restoring XML-based data to a database.
The default value is the same as V 1.04.
Values accepted by fiddle_timestamp:
0 => Do not fiddle timestamps
1 => Problem: All timestamps are unacceptable to the database. This is the
default.
All values are assumed to be of the form /^YYYYMMDD/
(fake reg exps are nice!).
Hours, minutes and seconds, if present, are ignored.
Timestamps undergo either 1 or 2 transformations.
Firstly, if the value matches /^0000/, convert it to 19700101.
Then, all values are converted to YYYY-MM-DD 00:00:00.
Eg: This - 00000000 - is converted to 1970-01-01 00:00:00
and today - 20050415 - is converted to 2005-04-15 00:00:00.
You would use this option when transferring data from MySQL's 'timestamp'
type to Postgres' 'timestamp' type, and MySQL output values match
/^(\d{8})/.
2 => Problem: Some timestamps are unacceptable to the database.
Timestamps undergo either 0 or 1 transformations.
If the value matches /^0000/, convert it to 1970-01-01 00:00:00.
Values not matching that pattern are not converted.
Eg: This - 0000-00-00 00:00:00 - is converted to 1970-01-01 00:00:00
and today - 2005-04-15 09:34:00 - is not converted.
You would use this option when transferring data from MySQL's 'datetime'
type to Postgres' 'datetime' type, and some MySQL output values match
/0000-00-00 00:00:00/ and some values are real dates, such as
2005-04-15 09:34:00.
- Expand the docs referring to fiddle_timestamp
1.04 2005-03-02T13:20:00
- A new option has been added to the constructor: skip_schema.
Here, 'schema' is defined to be the prefix on a table name,
and to be separated from the table name by a '.'.
Eg: The backup phase, with Postgres as the input database, will output tables
with names like 'information_schema.sql_features' and 'pg_catalog.pg_aggregate'.
If new is called as new(skip_schema => ['some_schema_name']), the restore phase
does not restore any tables in the named schema.
This parameter is optional. It defaults to [], so the module behaves as it did
before.
- A new option has been added to the constructor: transform_tablenames.
Now, new(transform_tablenames => 1) chops the schema, up to and including the
first '.', off table names. Thus a table exported from Postgres as
'public.service' can be renamed 'service' when being imported into another
database, eg MySQL.
Note: You would normally use these options to port data from Postgres to MySQL:
new(skip_schema => ['information_schema', 'pg_catalog'],
transform_tablenames => 1).
This parameter is optional. The default value is 0, so the module behaves as
it did before.
1.03 2004-09-14T13:39:00
- A new option has been added to the constructor: fiddle_timestamp.
If you call new(fiddle_timestamp => 0), we skip the documented process of
fiddling values of type timestamp during a call to restore(), so that the data
being restored is inserted as-is. This option was requested by Daniel
Santamaria.
This parameter is optional. The default value 1, so the module behaves as it
did before.
1.02 2004-08-26T12:57:00
- A new option has been added to the constructor: skip_tables.
If new is called as new(skip_tables => ['some_table_name']), the restore phase
does not restore the tables named in the call to new().
This option is designed to work with CGI scripts using the module CGI::Sessions.
Now, the CGI script can run with the current CGI::Session data, and stale
CGI::Session data is not restored from the XML file.
This parameter is optional. It defaults to [], so the module behaves as it did
before.
1.01 2004-07-19T14:43:00
- Change Makefile.PL to coexist with Module::Build
1.00 2004-01-22T12:37:29
- Original version