✅ 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 Name | Description |
|---|---|
ID | Unique ID of the changeset (from your changelog) |
AUTHOR | The name of the developer or tool that wrote the changeset |
FILENAME | The changelog file the changeset came from |
DATEEXECUTED | Timestamp when the changeset was executed |
ORDEREXECUTED | Sequence number of execution |
MD5SUM | Checksum to detect changes to an already-applied changeset |
EXECTYPE | Result: EXECUTED, FAILED, SKIPPED, etc. |
TAG | Optional 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.