User Tools

Site Tools


Why Are Patch Files Needed

Why are patch files needed when Lure has access to all the source code?

As a general rule Lure automates merging changes from source files to an existing target database environment. However Lure will never automatically make changes to existing tables because of the risk of loosing data. To explain, consider the scenario where a table column has been renamed. During import Lure compares the table in the target database with the source code and determines that a column needs to be dropped and another column needs to be added. However clearly if Lure would drop and add a column (as opposed to just renaming the column) the data in the original column would be lost.

In general there could be many different reasonable paths to go from version 1 of a table to version 2 and many of these different paths would yield different data as a result. Lure does not (cannot) make any assumptions as to which path is the intended path.

To be clear, Lure will correctly migrate all indexes, constraints, materialized view logs and triggers for the table and don't need patch files for these object types. It is just the basic structure of the table that Lure does not update automatically.

Lure depends on developers to provide hand coded/reviewed patch files that will correctly migrate the structure of the tables and maintain the integrity of the data.

For a related reason updates to Oracle cluster objects also requires patch files. Lure's default strategy to update clusters is to drop and re-create them. However if a cluster already has a table created on it then the drop will fail (Lure does not use the INCLUDING TABLES clause as this will risk loosing data). So in order to update a cluster that already has a table defined on it a patch file is required.

Lure doesn't strictly need patch files for any other object type. For example, even though Lure updates the DDL for an index by dropping and recreating the index, no data is lost. In terms of both source code and the data stored the end result is the same. The same applies to materialized views.

However, for objects like indexes or materialized views that could contain large data sets this dropping and recreating path may not be the most efficient way to handle the update. For this reason Lure supports patch files for a few other object types. Do note however that providing patch files for these other object types is definitely optional.

Next: Patch File Types

why_are_patch_files_needed.txt · Last modified: 2013/07/25 21:00 (external edit)

Page Tools