-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More improvements for PostgreSQL parse / diff (#161)
* Fix ::Parser::DBI::PostgreSQL bug that swapped on_update and on_delete The parser was storing the ON UPDATE value into the constraint's on_delete attribute, and vice versa. This caused foreign keys to always show as diffs in SQL::Translator::Diff if the on_update differed from on_delete. * Add option to run t/66-postgres-dbi-parser.t with Test::PostgreSQL Test::PostgreSQL requires the postgres server binaries to be installed on the host, which is a steep requirement. So, eval{} both the presence of the module and whether the module is successfully able to create a postgres instance. If so, use that. (but only if none of the env variables were set) * New ::Parser::DBI::PostgreSQL option deconstruct_enum_types The ::Producer::PostgreSQL will take a column definition of data_type 'enum' and convert it to a postgres custom data type, and then declare the column of that type. When parsed, the column no longer shows the values of the enum and the data_type is the custom name rather than 'enum'. This new option reaches into the postgres type to find the enum values, and reverts the data_type to 'enum', like it was originally. * Handle addition of enum values in ::Producer::PostgreSQL->alter_field Now, when producing a diff between two enum columns where the list of values are known, and when the postgres version is greater than 9.001, the producer will generate an ALTER TYPE ... ADD VALUE statments if the new enum includes values that the old one did not. This is an easy case to support because it does not involve re-creating the type. The harder case of removing an enum value is not supported, yet. The output includes a SQL comment to that effect, giving the user a note that they need to perform that step on their own.
- Loading branch information
Showing
4 changed files
with
141 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters