Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a17cbcc

Browse files
committed
Added documentation on DATABASECHANGELOG and DATABASECHANGELOGLOCK tables
1 parent e4b726a commit a17cbcc

File tree

3 files changed

+57
-2
lines changed

3 files changed

+57
-2
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
layout: default
3+
title: DatabaseChangeLog Table
4+
---
5+
6+
# DATABASECHANGELOG table
7+
8+
Liquibase uses the DATABASECHANGELOG table to track which changeSets have been ran.
9+
10+
The table tracks each changeSet as a row, identified by a combination of the "id", "author" and a "filename" column which stores the path to the changelog file.
11+
12+
<table>
13+
<tr><th>Column</th><th>Standard&nbsp;Data&nbsp;Type</th><th>Description</th></tr>
14+
<tr><td>ID</td><td>VARCHAR(255)</td><td>Value from the changeSet "id" attribute</td></tr>
15+
<tr><td>AUTHOR</td><td>VARCHAR(255)</td><td>Value from the changeSet "author" attribute</td></tr>
16+
<tr><td>FILENAME</td><td>VARCHAR(255)</td><td>Path to the changelog. This may be an absolute path or a relative path depending on how the changelog was passed to Liquibase. For best results, it should be a relative path</td></tr>
17+
<tr><td>DATEEXECUTED</td><td>DATETIME</td><td>Date/time of when the changeSet was executed. Used with ORDEREXECUTED to determine rollback order</td></tr>
18+
<tr><td>ORDEREXECUTED</td><td>INT</td><td>Order that the changeSets were executed. Used in addition to DATEEXECUTED to ensure order is correct even when the databases datetime supports poor resolution.<br><br>NOTE: The values are only guaranteed to be increasing within an individual update run. There are times where they will restart at zero.</td></tr>
19+
<tr><td>EXECTYPE</td><td>VARCHAR(10)</td><td>Description of how the changeSet was executed. Possible values include "EXECUTED", "FAILED", "SKIPPED", "RERAN", and "MARK_RAN", </td></tr>
20+
<tr><td>MD5SUM</td><td>VARCHAR(35)</td><td>Checksum of the changeSet when it was executed. Used on each run to ensure there have been no unexpected changes to changSet in the changelog file</td></tr>
21+
<tr><td>DESCRIPTION</td><td>VARCHAR(255)</td><td>Short auto-generated human readable description of changeSet</td></tr>
22+
<tr><td>COMMENTS</td><td>VARCHAR(255)</td><td>Value from the changeSet "comment" attribute</td></tr>
23+
<tr><td>TAG</td><td>VARCHAR(255)</td><td>Tracks which changeSets correspond to tag operations.</td></tr>
24+
<tr><td>LIQUIBASE</td><td>VARCHAR(20)</td><td>Version of Liquibase used to execute the changeSet</td></tr>
25+
</table>
26+
27+
### Notes
28+
29+
There is no primary key on the table. This is to avoid any database-specific restrictions on key lengths.
30+
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
layout: default
3+
title: DatabaseChangeLogLock Table
4+
---
5+
6+
# DATABASECHANGELOGLOCK table
7+
8+
Liquibase uses the DATABASECHANGELOGLOCK table ensure only one instance of Liquibase is running at one time.
9+
10+
Because Liquibase simply reads from the [DATABASECHANGELOG](databasechangelog_table.html) table to determine which changeSets need to run, if multiple instances of Liquibase are executed against the same database concurrently you will get conflicts.
11+
This can happen if multiple developers use the same database instance or if there are multiple servers in a cluster which auto-run Liquibase on startup.
12+
13+
<table>
14+
<tr><th>Column</th><th>Standard&nbsp;Data&nbsp;Type</th><th>Description</th></tr>
15+
<tr><td>ID</td><td>INT</td><td>Id of the lock. Currently there is only one lock, but is available for future use</td></tr>
16+
<tr><td>LOCKED</td><td>INT</td><td>Set to "1" if the Liquibase is running against this database. Otherwise set to "0"</td></tr>
17+
<tr><td>LOCKGRANTED</td><td>DATETIME</td><td>Date and time that the lock was granted</td></tr>
18+
<tr><td>LOCKEDBY</td><td>VARCHAR(255)</td><td>Human-readable description of who the lock was granted to.</td></tr>
19+
</table>
20+
21+
### Notes
22+
23+
If Liquibase does not exit cleanly, the lock row may be left as locked. You can clear out the current lock by running `liquibase releaseLocks` which runs `UPDATE DATABASECHANGELOGLOCK SET LOCKED=0`
24+

documentation/index.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,10 @@ includeDaticalBox: true
4747
<li><a href="cdi.html">CDI Environment</a></li>
4848
</ul>
4949

50-
<h2>Developing Extensions</h2>
50+
<h2>Internals</h2>
5151
<ul>
52-
<li><a href="sdk/index.html">Liquibase SDK</a></li>
52+
<li><a href="databasechangelog_table.html">DATABASECHANGELOG table</a></li>
53+
<li><a href="databasechangeloglock_table.html">DATABASECHANGELOGLOCK table</a></li>
5354
</ul>
5455
</div>
5556

0 commit comments

Comments
 (0)