Dblift Logo

Generated: {{ report_time|default(now().strftime('%Y-%m-%d %H:%M:%S')) }}

Server: {{ server_name|default('localhost') }}

Database: {{ database_name }}

Schema: {{ schema_name }}

{% set schema_version = current_version %} {% if not schema_version and unified_commands %} {% for cmd in unified_commands %} {% if not schema_version and cmd.result %} {% set result = cmd.result %} {% set test_version = result.current_schema_version|default('') %} {% if test_version %} {% set schema_version = result.current_schema_version %} {% endif %} {% endif %} {% if not schema_version and cmd.migrations and cmd.migrations|length > 0 %} {% set last_migration = cmd.migrations[-1] %} {% if last_migration.version %} {% set schema_version = last_migration.version %} {% endif %} {% endif %} {% endfor %} {% endif %} {% if not schema_version and command_results %} {% for cmd_result in command_results %} {% if not schema_version and cmd_result.result %} {% set result = cmd_result.result %} {% set test_version = result.current_schema_version|default('') %} {% if test_version %} {% set schema_version = result.current_schema_version %} {% endif %} {% endif %} {% endfor %} {% endif %} {% if not schema_version and migration_data %} {% if migration_data.last_version %} {% set schema_version = migration_data.last_version %} {% elif migration_data.applied_versions and migration_data.applied_versions|length > 0 %} {% set schema_version = migration_data.applied_versions[-1] %} {% endif %} {% endif %} {% if not schema_version and result %} {% set test_version = result.current_schema_version|default('') %} {% if test_version %} {% set schema_version = result.current_schema_version %} {% endif %} {% endif %} {% if schema_version %}

Schema Version: {{ schema_version }}

{% else %}

Schema Version:

{% endif %} {% if db_version %}

DB Version: {{ db_version }}

{% endif %} {% if native_driver %}

Driver: {{ native_driver }}

{% endif %} {% if database_url_masked %}

Database URL: {{ database_url_masked }}

{% endif %} {% if unified_commands and unified_commands[0].result %} {% set result = unified_commands[0].result %} {% set test_db_version = result.db_version|default('') %} {% if test_db_version and not db_version %}

DB Version: {{ result.db_version }}

{% endif %} {% set test_native_driver = result.native_driver|default('') %} {% if test_native_driver and not native_driver %}

Driver: {{ result.native_driver }}

{% endif %} {% set test_database_url = result.database_url_masked|default('') %} {% if test_database_url and not database_url_masked %}

Database URL: {{ result.database_url_masked }}

{% endif %} {% set test_server_name = result.server_name|default('') %} {% if test_server_name and not server_name %}

Server: {{ result.server_name }}

{% endif %} {% endif %}
{# Global color mapping for object type badges - reusable across all commands #} {# Using distinct colors that don't conflict with command statuses (teal/cyan/red) or operations #} {% set get_object_type_badge = { 'schema': 'bg-purple-500', 'table': 'bg-emerald-500', 'view': 'bg-indigo-500', 'materialized_view': 'bg-indigo-600', 'materialized_query_table': 'bg-indigo-600', 'function': 'bg-violet-500', 'procedure': 'bg-violet-600', 'sequence': 'bg-emerald-600', 'trigger': 'bg-pink-500', 'index': 'bg-sky-500', 'indexes': 'bg-sky-500', 'foreign_key': 'bg-rose-500', 'extension': 'bg-purple-600', 'domain': 'bg-slate-400', 'type': 'bg-slate-400', 'user_defined_type': 'bg-slate-400', 'alias': 'bg-slate-400', 'synonym': 'bg-slate-400', 'module': 'bg-slate-500', 'event': 'bg-pink-600', 'global_temporary_table': 'bg-emerald-400', 'package': 'bg-violet-600', 'package_body': 'bg-violet-700', 'database_link': 'bg-slate-500', 'foreign_data_wrapper': 'bg-slate-500', 'foreign_server': 'bg-slate-500', 'partition': 'bg-slate-500', 'constraint': 'bg-rose-600', 'role': 'bg-slate-500', 'user': 'bg-slate-500', 'database': 'bg-purple-600' } %} {% set unified_commands = [] %} {% if using_multi_command and multi_commands %} {% set unified_commands = multi_commands %} {% elif command_type %} {% if command_type == 'DIFF' and diff_data %} {% set _ = unified_commands.append({ 'command_type': command_type, 'success': operation_success, 'result': result, 'error_message': error_message, 'migrations': migration_data if migration_data else [], 'per_migration_journal': per_migration_journal if per_migration_journal else {}, 'timestamp': timestamp if timestamp else 'N/A', 'execution_time': execution_time if execution_time else 0, 'diff_data': diff_data }) %} {% else %} {% set _ = unified_commands.append({ 'command_type': command_type, 'success': operation_success, 'result': result, 'error_message': error_message, 'migrations': migration_data if migration_data else [], 'per_migration_journal': per_migration_journal if per_migration_journal else {}, 'timestamp': timestamp if timestamp else 'N/A', 'execution_time': execution_time if execution_time else 0 }) %} {% endif %} {% endif %} {% if unified_commands %}

Commands

{% if unified_commands and unified_commands[0].result and unified_commands[0].result.cli_options %} {% set is_dry_run = unified_commands[0].result.cli_options.get('dry_run', False) %} {% if is_dry_run %}
DRY RUN MODE

No migrations were actually executed. This report shows what would have been executed.

{% endif %} {% endif %} {% if unified_commands and unified_commands[0].result and unified_commands[0].result.cli_options %} {% set global_opts = unified_commands[0].result.cli_options %} {% set filtered_opts = {} %} {% for key, value in global_opts.items() %} {% if value not in [None, False, '', [], {}] and key not in ['snapshot', 'operation', 'migration', 'validation', 'introspection_quality', 'schema'] %} {% set _ = filtered_opts.update({key: value}) %} {% endif %} {% endfor %} {% if filtered_opts %}
Command Options: {% for key, value in filtered_opts.items() %} --{{ key|replace('_', '-') }}: {% if value is mapping %} {{ value|tojson }} {% elif value is iterable and value is not string %} {{ value|join(', ') }} {% elif value == True %} enabled {% else %} {{ value }} {% endif %} {% endfor %}
{% endif %} {% endif %}
{% for cmd in unified_commands %} {% set diff_data = None %}
Executed at {{ cmd.timestamp }} • {{ cmd.execution_time }} ms
{% if not cmd.success and cmd.error_message %}
Error: {{ cmd.error_message }}
{% endif %} {% if cmd.command_type in ['MIGRATE','UNDO'] and cmd.per_migration_journal %} {% set ns_summary = namespace(total_stmts=0, total_time=0, min_time=999999, max_time=0) %} {% for mig_script, mj in cmd.per_migration_journal.items() %} {% if mj.statements %} {% set ns_summary.total_stmts = ns_summary.total_stmts + mj.statements|length %} {% set ns_summary.total_time = ns_summary.total_time + (mj.total_execution_time or 0) %} {% if mj.min_statement_time and mj.min_statement_time < ns_summary.min_time %} {% set ns_summary.min_time = mj.min_statement_time %} {% endif %} {% if mj.max_statement_time and mj.max_statement_time > ns_summary.max_time %} {% set ns_summary.max_time = mj.max_statement_time %} {% endif %} {% endif %} {% endfor %} {% if ns_summary.total_stmts > 0 %}
Overall Statement Statistics: {{ ns_summary.total_stmts }} statements Total: {{ ns_summary.total_time }} ms Avg: {{ (ns_summary.total_time / ns_summary.total_stmts)|round(2) }} ms Min/Max: {{ ns_summary.min_time }}/{{ ns_summary.max_time }} ms
{% endif %} {% endif %} {% if cmd.command_type == 'INFO' and cmd.migrations %}
{% for migration in cmd.migrations %} {% endfor %}
Version Description Type Status Installed On Installed By Execution Time
{{ migration.version|default('N/A') }} {{ migration.description|default(migration.script) }} {% if migration.type == 'VERSIONED' or migration.type == 'SQL' %} Versioned {% elif migration.type == 'REPEATABLE' %} Repeatable {% elif migration.type == 'UNDO_SQL' %} Undo {% elif migration.type == 'BASELINE' %} Baseline {% else %} {{ migration.type|default('N/A') }} {% endif %} {% if migration.status|lower == 'success' or migration.status|lower == 'applied' %} {{ migration.status }} {% elif migration.status|lower == 'pending' %} {{ migration.status }} {% elif migration.status|lower == 'failed' %} {{ migration.status }} {% else %} {{ migration.status }} {% endif %} {{ migration.installed_on|default('N/A') }} {{ migration.installed_by|default('N/A') }} {{ migration.execution_time|default('N/A') }}
{% elif cmd.command_type in ['MIGRATE','UNDO'] %}
{% for migration in cmd.migrations %} {% set mj = cmd.per_migration_journal.get(migration.script) if cmd.per_migration_journal else None %}

{% if mj and mj.statements and mj.statements|length > 0 %}
{% set total_time = mj.total_execution_time or 1 %} {% set ns = namespace(cum=0) %} {% for stmt in mj.statements %} {% set width = (stmt.execution_time / total_time * 100) if total_time else 0 %} {% set offset = (ns.cum / total_time * 100) if total_time else 0 %} {% set cls = 'bg-dblift-teal-500' %} {% if mj.avg_statement_time and stmt.execution_time > (mj.avg_statement_time * 2) %} {% set cls = 'bg-yellow-500' %} {% endif %} {% set ns.cum = ns.cum + stmt.execution_time %} {% endfor %}
# Statement Timeline Execution Time
{{ loop.index }}
{{ stmt.statement }}
{{ stmt.execution_time }} ms
{% if mj and mj.object_operations %} {% set mig_obj_breakdown = {} %} {% for op in mj.object_operations %} {% set op_type = op.get('operation', 'UNKNOWN') %} {% set obj_type = op.get('object_type', 'UNKNOWN') %} {% set key = op_type + '_' + obj_type %} {% if key not in mig_obj_breakdown %} {% set _ = mig_obj_breakdown.update({key: {'operation': op_type, 'type': obj_type, 'count': 0, 'names': []}}) %} {% endif %} {% set _ = mig_obj_breakdown[key].update({'count': mig_obj_breakdown[key]['count'] + 1}) %} {% if op.get('object_name') %} {% set _ = mig_obj_breakdown[key]['names'].append(op.get('object_name')) %} {% endif %} {% endfor %} {% if mig_obj_breakdown %}
Database Objects
{% for key, data in mig_obj_breakdown.items() %} {% endfor %}
Operation Type Count Objects
{{ data.operation }} {{ data.type.replace('_', ' ')|title }} {{ data.count }} {% if data.names|length > 0 %} {{ data.names|join(', ') }} {% else %} - {% endif %}
{% endif %} {% endif %} {% else %}
No statement timing available.
{% endif %}
{% endfor %} {% if not cmd.migrations %}
{% if cmd.command_type == 'MIGRATE' %} No pending migrations found
All migrations are already applied to the database. {% elif cmd.command_type == 'UNDO' %} No migrations to undo
No applicable migrations found for undo operation. {% else %} No migrations to process
No applicable migrations found for this operation. {% endif %}
{% endif %}
{% elif cmd.command_type == 'DIFF' and cmd.diff_data %} {% set diff_data = cmd.diff_data %} {% if cmd.result and cmd.result.cli_options and cmd.result.cli_options.get('snapshot') %} {% set snapshot_metadata = cmd.result.cli_options.get('snapshot') %} {% set validation_metadata = snapshot_metadata.get('validation') %} {% set introspection_quality = snapshot_metadata.get('introspection_quality') %} {% if validation_metadata or introspection_quality %}

Introspection Quality & Validation

{% if introspection_quality %}

Introspection Quality

{% set completeness = introspection_quality.get('completeness_score', 0) %} {% set confidence = introspection_quality.get('confidence_level', 'UNKNOWN') %} {% set error_count = introspection_quality.get('error_count', 0) %} {% set warning_count = introspection_quality.get('warning_count', 0) %}
Completeness: {{ (completeness * 100)|round(1) }}%
Confidence Level: {{ confidence }}
{% if error_count > 0 %}
Errors: {{ error_count }}
{% endif %} {% if warning_count > 0 %}
Warnings: {{ warning_count }}
{% endif %} {% if error_count == 0 and warning_count == 0 %}
✓ No errors or warnings
{% endif %}
{% endif %} {% if validation_metadata %}

Validation Results

{% set overall_passed = validation_metadata.get('overall_passed', True) %} {% set confidence = validation_metadata.get('confidence', {}) %} {% set total_errors = validation_metadata.get('total_errors', 0) %} {% set total_warnings = validation_metadata.get('total_warnings', 0) %}
Overall Status: {% if overall_passed %}✓ PASSED{% else %}✗ FAILED{% endif %}
{% if confidence %} {% set confidence_level = confidence.get('confidence_level', 'UNKNOWN') %} {% set overall_score = confidence.get('overall_score', 0) %}
Confidence: {{ confidence_level }} ({{ (overall_score * 100)|round(1) }}%)
{% set breakdown = confidence.get('breakdown', {}) %} {% if breakdown %}
Score Breakdown:
{% for component, details in breakdown.items() %} {% set score = details.get('score', 0) %}
{{ component.replace('_', ' ')|title }}: {{ (score * 100)|round(1) }}%
{% endfor %}
{% endif %} {% endif %} {% if total_errors > 0 %}
Validation Errors: {{ total_errors }}
{% endif %} {% if total_warnings > 0 %}
Validation Warnings: {{ total_warnings }}
{% endif %} {% if total_errors == 0 and total_warnings == 0 %}
✓ No validation issues
{% endif %}
{% endif %}
{% endif %} {% endif %}
Missing Objects

{{ (diff_data.missing_tables|length if diff_data.missing_tables else 0) + (diff_data.missing_views|length if diff_data.missing_views else 0) + (diff_data.missing_indexes|length if diff_data.missing_indexes else 0) + (diff_data.missing_sequences|length if diff_data.missing_sequences else 0) + (diff_data.missing_triggers|length if diff_data.missing_triggers else 0) + (diff_data.missing_procedures|length if diff_data.missing_procedures else 0) + (diff_data.missing_functions|length if diff_data.missing_functions else 0) }}

Tables: {{ diff_data.missing_table_count|default(0) }}, Views: {{ diff_data.missing_views|length if diff_data.missing_views else 0 }}, Indexes: {{ diff_data.missing_indexes|length if diff_data.missing_indexes else 0 }}, Others: {{ (diff_data.missing_sequences|length if diff_data.missing_sequences else 0) + (diff_data.missing_triggers|length if diff_data.missing_triggers else 0) + (diff_data.missing_procedures|length if diff_data.missing_procedures else 0) + (diff_data.missing_functions|length if diff_data.missing_functions else 0) }}
Extra Objects

{{ (diff_data.extra_tables|length if diff_data.extra_tables else 0) + (diff_data.extra_views|length if diff_data.extra_views else 0) + (diff_data.extra_indexes|length if diff_data.extra_indexes else 0) + (diff_data.extra_sequences|length if diff_data.extra_sequences else 0) + (diff_data.extra_triggers|length if diff_data.extra_triggers else 0) + (diff_data.extra_procedures|length if diff_data.extra_procedures else 0) + (diff_data.extra_functions|length if diff_data.extra_functions else 0) }}

Tables: {{ diff_data.extra_table_count|default(0) }}, Views: {{ diff_data.extra_views|length if diff_data.extra_views else 0 }}, Indexes: {{ diff_data.extra_indexes|length if diff_data.extra_indexes else 0 }}, Others: {{ (diff_data.extra_sequences|length if diff_data.extra_sequences else 0) + (diff_data.extra_triggers|length if diff_data.extra_triggers else 0) + (diff_data.extra_procedures|length if diff_data.extra_procedures else 0) + (diff_data.extra_functions|length if diff_data.extra_functions else 0) }}
Modified Objects

{{ (diff_data.modified_tables|length if diff_data.modified_tables else 0) + (diff_data.modified_views|length if diff_data.modified_views else 0) + (diff_data.modified_indexes|length if diff_data.modified_indexes else 0) + (diff_data.modified_sequences|length if diff_data.modified_sequences else 0) + (diff_data.modified_triggers|length if diff_data.modified_triggers else 0) + (diff_data.modified_procedures|length if diff_data.modified_procedures else 0) + (diff_data.modified_functions|length if diff_data.modified_functions else 0) }}

Tables: {{ diff_data.modified_table_count|default(0) }}, Views: {{ diff_data.modified_views|length if diff_data.modified_views else 0 }}, Indexes: {{ diff_data.modified_indexes|length if diff_data.modified_indexes else 0 }}, Others: {{ (diff_data.modified_sequences|length if diff_data.modified_sequences else 0) + (diff_data.modified_triggers|length if diff_data.modified_triggers else 0) + (diff_data.modified_procedures|length if diff_data.modified_procedures else 0) + (diff_data.modified_functions|length if diff_data.modified_functions else 0) }}
Total Diffs

{{ diff_data.total_differences }}

{% set has_missing_or_extra = (diff_data.missing_tables or diff_data.extra_tables or diff_data.missing_views or diff_data.extra_views or diff_data.missing_indexes or diff_data.extra_indexes or diff_data.missing_sequences or diff_data.extra_sequences or diff_data.missing_triggers or diff_data.extra_triggers or diff_data.missing_procedures or diff_data.extra_procedures or diff_data.missing_functions or diff_data.extra_functions or diff_data.missing_user_defined_types or diff_data.extra_user_defined_types or diff_data.missing_extensions or diff_data.extra_extensions or diff_data.missing_events or diff_data.extra_events) %} {% if has_missing_or_extra %}

Missing & Extra Objects

{% if diff_data.missing_tables %}
Missing Tables ({{ diff_data.missing_tables|length }})

These tables exist in {{ diff_data.source_type }} but not in {{ diff_data.target_type }}:

    {% for table in diff_data.missing_tables %}
  • {{ table }}
  • {% endfor %}
{% endif %} {% if diff_data.missing_views %}
Missing Views ({{ diff_data.missing_views|length }})

These views exist in {{ diff_data.source_type }} but not in {{ diff_data.target_type }}:

    {% for view in diff_data.missing_views %}
  • {{ view }}
  • {% endfor %}
{% endif %} {% if diff_data.missing_indexes %}
Missing Indexes ({{ diff_data.missing_indexes|length }})

These indexes exist in {{ diff_data.source_type }} but not in {{ diff_data.target_type }}:

    {% for index in diff_data.missing_indexes %}
  • {{ index }}
  • {% endfor %}
{% endif %} {% if diff_data.missing_sequences %}
Missing Sequences ({{ diff_data.missing_sequences|length }})

These sequences exist in {{ diff_data.source_type }} but not in {{ diff_data.target_type }}:

    {% for sequence in diff_data.missing_sequences %}
  • {{ sequence }}
  • {% endfor %}
{% endif %} {% if diff_data.missing_triggers %}
Missing Triggers ({{ diff_data.missing_triggers|length }})

These triggers exist in {{ diff_data.source_type }} but not in {{ diff_data.target_type }}:

    {% for trigger in diff_data.missing_triggers %}
  • {{ trigger }}
  • {% endfor %}
{% endif %} {% if diff_data.missing_procedures %}
Missing Procedures ({{ diff_data.missing_procedures|length }})

These procedures exist in {{ diff_data.source_type }} but not in {{ diff_data.target_type }}:

    {% for procedure in diff_data.missing_procedures %}
  • {{ procedure }}
  • {% endfor %}
{% endif %} {% if diff_data.missing_functions %}
Missing Functions ({{ diff_data.missing_functions|length }})

These functions exist in {{ diff_data.source_type }} but not in {{ diff_data.target_type }}:

    {% for function in diff_data.missing_functions %}
  • {{ function }}
  • {% endfor %}
{% endif %} {% if diff_data.missing_user_defined_types %}
Missing User-Defined Types ({{ diff_data.missing_user_defined_types|length }})

These user-defined types exist in {{ diff_data.source_type }} but not in {{ diff_data.target_type }}:

    {% for udt in diff_data.missing_user_defined_types %}
  • {{ udt }}
  • {% endfor %}
{% endif %} {% if diff_data.extra_tables %}
Extra Tables ({{ diff_data.extra_tables|length }})

These tables exist in {{ diff_data.target_type }} but not in {{ diff_data.source_type }}:

    {% for table in diff_data.extra_tables %}
  • {{ table }}
  • {% endfor %}
{% endif %} {% if diff_data.extra_views %}
Extra Views ({{ diff_data.extra_views|length }})

These views exist in {{ diff_data.target_type }} but not in {{ diff_data.source_type }}:

    {% for view in diff_data.extra_views %}
  • {{ view }}
  • {% endfor %}
{% endif %} {% if diff_data.extra_indexes %}
Extra Indexes ({{ diff_data.extra_indexes|length }})

These indexes exist in {{ diff_data.target_type }} but not in {{ diff_data.source_type }}:

    {% for index in diff_data.extra_indexes %}
  • {{ index }}
  • {% endfor %}
{% endif %} {% if diff_data.extra_sequences %}
Extra Sequences ({{ diff_data.extra_sequences|length }})

These sequences exist in {{ diff_data.target_type }} but not in {{ diff_data.source_type }}:

    {% for sequence in diff_data.extra_sequences %}
  • {{ sequence }}
  • {% endfor %}
{% endif %} {% if diff_data.extra_triggers %}
Extra Triggers ({{ diff_data.extra_triggers|length }})

These triggers exist in {{ diff_data.target_type }} but not in {{ diff_data.source_type }}:

    {% for trigger in diff_data.extra_triggers %}
  • {{ trigger }}
  • {% endfor %}
{% endif %} {% if diff_data.extra_procedures %}
Extra Procedures ({{ diff_data.extra_procedures|length }})

These procedures exist in {{ diff_data.target_type }} but not in {{ diff_data.source_type }}:

    {% for procedure in diff_data.extra_procedures %}
  • {{ procedure }}
  • {% endfor %}
{% endif %} {% if diff_data.extra_functions %}
Extra Functions ({{ diff_data.extra_functions|length }})

These functions exist in {{ diff_data.target_type }} but not in {{ diff_data.source_type }}:

    {% for function in diff_data.extra_functions %}
  • {{ function }}
  • {% endfor %}
{% endif %} {% if diff_data.extra_user_defined_types %}
Extra User-Defined Types ({{ diff_data.extra_user_defined_types|length }})

These user-defined types exist in {{ diff_data.target_type }} but not in {{ diff_data.source_type }}:

    {% for udt in diff_data.extra_user_defined_types %}
  • {{ udt }}
  • {% endfor %}
{% endif %}
{% endif %} {% if diff_data.modified_tables %}

Modified Tables

{% for table in diff_data.modified_tables %}

{{ table.table_name }} {{ table.severity|upper }}

{{ table.diff_count }} differences
{% if table.unified_diff and table.unified_diff.lines %}
SQL Diff View
{{ diff_data.source_type|default('Expected') }} (Old) ↔ {{ diff_data.target_type|default('Actual') }} (New)
{% for line in table.unified_diff.lines %} {% endfor %}
{% if line.before_num %}{{ line.before_num }}{% endif %} {% if line.type == 'removed' or line.type == 'equal' %}
{{ line.content|e }}
{% endif %}
{% if line.after_num %}{{ line.after_num }}{% endif %} {% if line.type == 'added' or line.type == 'equal' %}
{{ line.content|e }}
{% endif %}
{% endif %}
{% endfor %}
{% endif %} {% if diff_data.modified_views or diff_data.modified_indexes or diff_data.modified_sequences or diff_data.modified_triggers or diff_data.modified_procedures or diff_data.modified_functions %}

Other Modified Objects

{% if diff_data.modified_views %} {% for view in diff_data.modified_views %}
{{ view.view_name }}
{% if view.unified_diff and view.unified_diff.lines %}
{{ diff_data.source_type|default('Expected') }} (Old) ↔ {{ diff_data.target_type|default('Actual') }} (New)
{% for line in view.unified_diff.lines %} {% endfor %}
{% if line.before_num %}{{ line.before_num }}{% endif %} {% if line.type == 'removed' or line.type == 'equal' %}
{{ line.content|e }}
{% endif %}
{% if line.after_num %}{{ line.after_num }}{% endif %} {% if line.type == 'added' or line.type == 'equal' %}
{{ line.content|e }}
{% endif %}
{% endif %}
{% endfor %} {% endif %} {% if diff_data.modified_indexes %}

Modified Indexes

{% for index in diff_data.modified_indexes %}
{{ index.index_name|default(index) }}
{% set test_diff = index.unified_diff|default(None) %} {% if test_diff and index.unified_diff.lines %}
{{ diff_data.source_type|default('Expected') }} (Old) ↔ {{ diff_data.target_type|default('Actual') }} (New)
{% for line in index.unified_diff.lines %} {% endfor %}
{% if line.before_num %}{{ line.before_num }}{% endif %} {% if line.type == 'removed' or line.type == 'equal' %}
{{ line.content|e }}
{% endif %}
{% if line.after_num %}{{ line.after_num }}{% endif %} {% if line.type == 'added' or line.type == 'equal' %}
{{ line.content|e }}
{% endif %}
{% endif %}
{% endfor %} {% endif %} {% if diff_data.modified_sequences %}

Modified Sequences

{% for sequence in diff_data.modified_sequences %}
{{ sequence.sequence_name|default(sequence) }}
{% set test_diff = sequence.unified_diff|default(None) %} {% if test_diff and sequence.unified_diff.lines %}
{{ diff_data.source_type|default('Expected') }} (Old) ↔ {{ diff_data.target_type|default('Actual') }} (New)
{% for line in sequence.unified_diff.lines %} {% endfor %}
{% if line.before_num %}{{ line.before_num }}{% endif %} {% if line.type == 'removed' or line.type == 'equal' %}
{{ line.content|e }}
{% endif %}
{% if line.after_num %}{{ line.after_num }}{% endif %} {% if line.type == 'added' or line.type == 'equal' %}
{{ line.content|e }}
{% endif %}
{% endif %}
{% endfor %} {% endif %} {% if diff_data.modified_triggers %}

Modified Triggers

{% for trigger in diff_data.modified_triggers %}
{{ trigger.trigger_name|default(trigger) }}
{% set test_diff = trigger.unified_diff|default(None) %} {% if test_diff and trigger.unified_diff.lines %}
{{ diff_data.source_type|default('Expected') }} (Old) ↔ {{ diff_data.target_type|default('Actual') }} (New)
{% for line in trigger.unified_diff.lines %} {% endfor %}
{% if line.before_num %}{{ line.before_num }}{% endif %} {% if line.type == 'removed' or line.type == 'equal' %}
{{ line.content|e }}
{% endif %}
{% if line.after_num %}{{ line.after_num }}{% endif %} {% if line.type == 'added' or line.type == 'equal' %}
{{ line.content|e }}
{% endif %}
{% endif %}
{% endfor %} {% endif %} {% if diff_data.modified_procedures %}

Modified Procedures

{% for procedure in diff_data.modified_procedures %}
{{ procedure.procedure_name|default(procedure) }}
{% set test_diff = procedure.unified_diff|default(None) %} {% if test_diff and procedure.unified_diff.lines %}
{{ diff_data.source_type|default('Expected') }} (Old) ↔ {{ diff_data.target_type|default('Actual') }} (New)
{% for line in procedure.unified_diff.lines %} {% endfor %}
{% if line.before_num %}{{ line.before_num }}{% endif %} {% if line.type == 'removed' or line.type == 'equal' %}
{{ line.content|e }}
{% endif %}
{% if line.after_num %}{{ line.after_num }}{% endif %} {% if line.type == 'added' or line.type == 'equal' %}
{{ line.content|e }}
{% endif %}
{% endif %}
{% endfor %} {% endif %} {% if diff_data.modified_functions %}

Modified Functions

{% for function in diff_data.modified_functions %}
{{ function.function_name|default(function) }}
{% set test_diff = function.unified_diff|default(None) %} {% if test_diff and function.unified_diff.lines %}
{{ diff_data.source_type|default('Expected') }} (Old) ↔ {{ diff_data.target_type|default('Actual') }} (New)
{% for line in function.unified_diff.lines %} {% endfor %}
{% if line.before_num %}{{ line.before_num }}{% endif %} {% if line.type == 'removed' or line.type == 'equal' %}
{{ line.content|e }}
{% endif %}
{% if line.after_num %}{{ line.after_num }}{% endif %} {% if line.type == 'added' or line.type == 'equal' %}
{{ line.content|e }}
{% endif %}
{% endif %}
{% endfor %} {% endif %}
{% endif %} {% elif command_type == 'EXPORT-SCHEMA' and result %} {% if result.output_files or result.objects_exported or result.filters_applied %}

Export Results

{% set export_result = result %} {% set total_objects = export_result.objects_exported.values()|sum if export_result.objects_exported else 0 %} {% if export_result.objects_exported %}
Total Objects

{{ total_objects }}

Objects exported
Object Types

{{ export_result.objects_exported|length }}

Different types
Generated Files

{{ export_result.output_files|length if export_result.output_files else 0 }}

SQL files created
{% endif %} {% if export_result.objects_exported %}

Objects Exported

{% for obj_type, count in export_result.objects_exported.items() %} {{ obj_type }}: {{ count }} {% endfor %}
{% endif %} {% if export_result.output_files %}

Generated Files

{% for file in export_result.output_files %}
{{ file }}
{% endfor %}
{% endif %} {% if export_result.filters_applied %}

Filters Applied

{% for filter in export_result.filters_applied %} {{ filter }} {% endfor %}
{% endif %} {% if export_result.output_options %}

Output Options

{% for key, value in export_result.output_options.items() %}
{{ key|replace('_', ' ')|title }}: {% if value is sameas true %}Yes{% elif value is sameas false %}No{% else %}{{ value }}{% endif %}
{% endfor %}
{% endif %}
{% endif %} {% elif cmd.command_type == 'EXPORT-SCHEMA' and cmd.result %} {% if cmd.result.output_files or cmd.result.objects_exported or cmd.result.filters_applied %}

Export Results

{% set export_result = cmd.result %} {% set total_objects = export_result.objects_exported.values()|sum if export_result.objects_exported else 0 %} {% if export_result.objects_exported %}
Total Objects

{{ total_objects }}

Objects exported
Object Types

{{ export_result.objects_exported|length }}

Different types
Generated Files

{{ export_result.output_files|length if export_result.output_files else 0 }}

SQL files created
{% endif %} {% if export_result.objects_exported %}

Objects Exported

{% for obj_type, count in export_result.objects_exported.items() %} {{ obj_type }}: {{ count }} {% endfor %}
{% endif %} {% if export_result.output_files %}

Generated Files

{% for file in export_result.output_files %}
{{ file }}
{% endfor %}
{% endif %} {% if export_result.filters_applied %}

Filters Applied

{% for filter in export_result.filters_applied %} {{ filter }} {% endfor %}
{% endif %} {% if export_result.output_options %}

Output Options

{% for key, value in export_result.output_options.items() %}
{{ key|replace('_', ' ')|title }}: {% if value is sameas true %}Yes{% elif value is sameas false %}No{% else %}{{ value }}{% endif %}
{% endfor %}
{% endif %}
{% endif %} {% elif cmd.command_type == 'CLEAN' and cmd.result %} {% set objects_map = cmd.result.get_objects_by_type() %} {% set ns = namespace(total=0) %} {% for object_type, names in objects_map.items() %} {% set ns.total = ns.total + (names|length) %} {% endfor %}
Database Objects Cleaned: {{ ns.total }} object(s) dropped from schema {% if objects_map.get('schema') %} {% set schemas_list = objects_map.get('schema')|list|sort %} ({{ schemas_list|length }} schema(s) cleaned: {{ schemas_list|join(', ') }}) {% endif %}
{% for object_type, names in objects_map|dictsort %} {% set names_list = names|list|sort %} {% if names_list %} {% endif %} {% endfor %}
Object Type Count Objects
{{ object_type.replace('_', ' ')|title }} {{ names_list|length }} {{ names_list|join(', ') }}
{% elif cmd.command_type == 'VALIDATE' %}

Validation Results

{% if cmd.success %}

✓ All migrations validated successfully

{% if cmd.migrations %}

Validated {{ cmd.migrations|length }} migration(s)

{% endif %}
{% else %}

✗ Validation failed

{% if cmd.error_message %}

{{ cmd.error_message }}

{% endif %}
{% endif %} {% if cmd.migrations %}

Migration Status

{% for migration in cmd.migrations %}
{{ migration.script }} {% if migration.status|lower == 'success' or migration.status|lower == 'applied' %} Valid {% else %} Invalid {% endif %}
{% endfor %}
{% endif %}
{% elif cmd.command_type == 'BASELINE' %}

Baseline Information

{% if cmd.success %}

✓ Schema baselined successfully

{% if cmd.result %} {% set test_version = cmd.result.current_schema_version|default('') %} {% if test_version %}

Baseline version: {{ cmd.result.current_schema_version }}

{% endif %} {% endif %}
{% else %}

✗ Baseline failed

{% if cmd.error_message %}

{{ cmd.error_message }}

{% endif %}
{% endif %}
{% elif cmd.command_type == 'REPAIR' %}

Repair Results

{% if cmd.success %}

✓ Schema history table repaired successfully

{% else %}

✗ Repair failed

{% if cmd.error_message %}

{{ cmd.error_message }}

{% endif %}
{% endif %}
{% else %}

Command: {{ cmd.command_type }}

{% if cmd.success %}

✓ Command completed successfully

{% else %}

✗ Command failed

{% if cmd.error_message %}

{{ cmd.error_message }}

{% endif %}
{% endif %} {% if cmd.migrations %}

Migrations processed: {{ cmd.migrations|length }}

{% endif %}
{% endif %}
{% endfor %}
{% endif %} {% if false %}

Multi-Command Execution Summary

Commands Executed

{% for cmd in command_results %} {% endfor %}
# Command Status Execution Time Details
{{ loop.index }} {{ cmd.command_type }} {% if cmd.success %} Success {% else %} Failed {% endif %} {{ cmd.execution_time }} ms {% if not cmd.success and cmd.error_message %} {{ cmd.error_message }} {% else %} Completed at {{ cmd.timestamp }} {% endif %}

{% if operation_success %} All Commands Completed Successfully {% else %} Some Commands Failed {% endif %}

Total execution time: {{ execution_time }} ms

{% if not operation_success %}

Check each command for specific error details.

{% endif %}
{% endif %} {% if false %}

Operation Summary

{% if operation_success %} Operation Successful {% else %} Operation Failed {% endif %}

Command: {{ command_type }} {% if current_version %}Version: {{ current_version }}{% endif %} Execution time: {{ execution_time }} ms

{% if not operation_success %}

Error

{{ error_message }}

{% elif warnings and warnings|length > 0 %}

Warnings

{% for warning in warnings %}

{{ warning }}

{% endfor %}
{% endif %}
{% if migration_data and command_type == 'INFO' %}

Migration Statistics

{% set total = migration_data|length %} {% set success = migration_data|selectattr('status', 'equalto', 'SUCCESS')|list|length %} {% set pending = migration_data|selectattr('status', 'equalto', 'PENDING')|list|length %} {% set failed = migration_data|selectattr('status', 'equalto', 'FAILED')|list|length %} {% set outdated = migration_data|selectattr('status', 'equalto', 'OUTDATED')|list|length %} {% set undone = migration_data|selectattr('status', 'equalto', 'UNDONE')|list|length %} {# Use pre-calculated values from the result object #} {% set avg_time = avg_execution_time|default(0) %} {% set sum_time = total_execution_time|default(0) %} {% set count = execution_count|default(0) %}
Number of Migrations

{{ total }}

Success

{{ success }}

Avg Time

{{ avg_time }} ms

{% if undone > 0 %}
Undone

{{ undone }}

{% endif %} {% if pending > 0 %}
Pending

{{ pending }}

{% endif %} {% if failed > 0 %}
Failed

{{ failed }}

{% endif %} {% if outdated > 0 %}
Outdated

{{ outdated }}

{% endif %}
{% endif %}
{% endif %} {% if migration_data and command_type in ['MIGRATE', 'UNDO'] %} {% endif %}