| 1 | package DBIO::Firebird::Diff; | ||
| 2 | # ABSTRACT: Compare two introspected Firebird models | ||
| 3 | |||
| 4 | 3 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 3 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 3 | ▶ | use base 'DBIO::Diff::Base'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | |||
| 9 | |||
| 10 | 3 | ▶ | use DBIO::Firebird::Diff::Table (); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | 3 | ▶ | use DBIO::Firebird::Diff::Column (); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | 3 | ▶ | use DBIO::Firebird::Diff::Index (); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | |||
| 14 | 4 | ▶ | sub _build_operations { |
|
Subroutine
_build_operations: called CC=1 SCAR=0.0
| |||
| 15 | 4 | my ($self) = @_; | |
| 16 | 4 | my @ops; | |
| 17 | |||
| 18 | push @ops, DBIO::Firebird::Diff::Table->diff( | ||
| 19 | $self->source->{tables}, $self->target->{tables}, | ||
| 20 | $self->target->{columns}, $self->target->{foreign_keys}, | ||
| 21 | 4 | ); | |
| 22 | push @ops, DBIO::Firebird::Diff::Column->diff( | ||
| 23 | $self->source->{columns}, $self->target->{columns}, | ||
| 24 | $self->source->{tables}, $self->target->{tables}, | ||
| 25 | 4 | ); | |
| 26 | push @ops, DBIO::Firebird::Diff::Index->diff( | ||
| 27 | $self->source->{indexes}, $self->target->{indexes}, | ||
| 28 | $self->source->{tables}, $self->target->{tables}, | ||
| 29 | 4 | ); | |
| 30 | |||
| 31 | 4 | return \@ops; | |
| 32 | } | ||
| 33 | |||
| 34 | |||
| 35 | 3 | 1; | |
| 36 | |||
| 37 | __END__ | ||
| 38 | |||
| 39 | =pod | ||
| 40 | |||
| 41 | =encoding UTF-8 | ||
| 42 | |||
| 43 | =head1 NAME | ||
| 44 | |||
| 45 | DBIO::Firebird::Diff - Compare two introspected Firebird models | ||
| 46 | |||
| 47 | =head1 VERSION | ||
| 48 | |||
| 49 | version 0.900001 | ||
| 50 | |||
| 51 | =head1 DESCRIPTION | ||
| 52 | |||
| 53 | C<DBIO::Firebird::Diff> compares two introspected Firebird database models | ||
| 54 | (as produced by L<DBIO::Firebird::Introspect>) and produces a list of | ||
| 55 | structured diff operations. These operations can then be rendered to SQL or a | ||
| 56 | human-readable summary. | ||
| 57 | |||
| 58 | my $diff = DBIO::Firebird::Diff->new( | ||
| 59 | source => $current_model, | ||
| 60 | target => $desired_model, | ||
| 61 | ); | ||
| 62 | |||
| 63 | if ($diff->has_changes) { | ||
| 64 | print $diff->as_sql; | ||
| 65 | print $diff->summary; | ||
| 66 | } | ||
| 67 | |||
| 68 | Diff operations are generated in dependency order: tables first, then | ||
| 69 | columns, then indexes. | ||
| 70 | |||
| 71 | =seealso | ||
| 72 | |||
| 73 | =over 4 | ||
| 74 | |||
| 75 | =item * L<DBIO::Firebird::Deploy> - orchestrates introspection and diff | ||
| 76 | |||
| 77 | =item * L<DBIO::Firebird::Introspect> - produces the models being compared | ||
| 78 | |||
| 79 | =back | ||
| 80 | |||
| 81 | =head1 AUTHOR | ||
| 82 | |||
| 83 | DBIO & DBIx::Class Authors | ||
| 84 | |||
| 85 | =head1 COPYRIGHT AND LICENSE | ||
| 86 | |||
| 87 | Copyright (C) 2026 DBIO Authors | ||
| 88 | Portions Copyright (C) 2005-2025 DBIx::Class Authors | ||
| 89 | Based on DBIx::Class, heavily modified. | ||
| 90 | |||
| 91 | This is free software; you can redistribute it and/or modify it under | ||
| 92 | the same terms as the Perl 5 programming language system itself. | ||
| 93 | |||
| 94 | =cut | ||