Java.DBMigrationTools.What is a DATABASECHANGELOG table?

Short Answer

The DATABASECHANGELOG table is a system table created and maintained by Liquibase.
It tracks which changesets have already been executed, preventing duplicates and ensuring safe, repeatable database migrations.


🔎 Detailed Explanation

Whenever Liquibase applies a changeset from your changelog file, it logs a record in the DATABASECHANGELOG table. This allows Liquibase to:

  • Skip already executed changesets
  • Validate checksums (to detect tampering)
  • Maintain the execution order
  • Enable rollbacks and tagging

📋 Key Columns in DATABASECHANGELOG

Column NameDescription
IDUnique ID of the changeset (from your changelog)
AUTHORThe name of the developer or tool that wrote the changeset
FILENAMEThe changelog file the changeset came from
DATEEXECUTEDTimestamp when the changeset was executed
ORDEREXECUTEDSequence number of execution
MD5SUMChecksum to detect changes to an already-applied changeset
EXECTYPEResult: EXECUTED, FAILED, SKIPPED, etc.
TAGOptional tag label for schema versioning

🧠 Why Is This Table Important?

  • ✅ Prevents running the same changes twice
  • ✅ Ensures safe migrations across environments (dev, test, prod)
  • ✅ Enables rollback and versioning
  • ✅ Supports audit and compliance tracking

📌 Key Takeaways

DATABASECHANGELOG is the core mechanism Liquibase uses to track schema changes.
✅ It ensures that each changeset runs exactly once, safely and in order.
✅ It is stored inside your target database, alongside your actual tables.

This entry was posted in Без рубрики. Bookmark the permalink.