flyway_schema_history

143 rows


Description

Module: System/Database Management - Flyway Schema History Log
Purpose: This is a metadata table maintained by the Flyway database migration tool. It records every executed schema change (migration script) to ensure a controlled, versioned, and repeatable deployment process.
Data: Stores details about the migration, including its version number, description, the script file name, execution status, and timing.
Process Usage:
- Tracking: Flyway reads this table on startup to determine the current state of the database schema and identify which pending migrations need to be applied.
- Guarding: Prevents the same migration script from being executed multiple times.
- Auditing: Provides a complete audit trail of schema evolution.
Key Points:
- System Table: Should not be modified manually.
- installed_rank serves as the primary key and the order of execution.
Business Impact: Guarantees database consistency across all environments and supports reliable CI/CD pipelines for application updates.

Columns

Column Type Size Nulls Auto Default Children Parents Comments
installed_rank int4 10 null

Primary key
Format: Integer
Used as: The rank in which the migration was installed, defining the strict order of execution.

version varchar 50 null

The unique version number of the migration (e.g., V2__query.sql, V3__query.sql).

description varchar 200 null

A short description of the migration’s purpose.

type varchar 20 null

The type of migration (e.g., SQL for versioned scripts, BASELINE, or CALLBACK).

script varchar 1000 null

The name of the migration script file (e.g., V2__query.sql).

checksum int4 10 null

The checksum of the script. Used to detect accidental changes to migration files that have already been run.

installed_by varchar 100 null

The user or system account that executed the migration.

installed_on timestamp 29,6 now()

The timestamp when the migration was executed.

execution_time int4 10 null

The time (in milliseconds) taken to execute the migration script.

success bool 1 null

Boolean flag: TRUE if the migration executed successfully; FALSE if it failed, preventing subsequent migrations from running.

Indexes

Constraint Name Type Sort Column(s)
flyway_schema_history_pk Primary key Asc installed_rank
flyway_schema_history_s_idx Performance Asc success

Relationships