Cum să creezi un changelog JSON în Liquibase
DodaTech
Updated 2025-01-15
1 min read
In this tutorial, you'll learn about Cum să creezi un changelog JSON în Liquibase. We cover key concepts, practical examples, and best practices.
Liquibase suportă changelog-uri în format JSON, oferind o alternativă structurată pentru echipele care preferă JSON în locul XML sau YAML.
Problema
Echipa ta folosește JSON ca format standard pentru configurații. Liquibase permite definirea changelog-urilor în JSON.
Structura unui changelog JSON
{
"databaseChangeLog": [
{
"changeSet": {
"id": "1",
"author": "ionut",
"changes": [
{
"createTable": {
"tableName": "users",
"columns": [
{
"column": {
"name": "id",
"type": "int",
"autoIncrement": true,
"constraints": {
"primaryKey": true
}
}
},
{
"column": {
"name": "name",
"type": "varchar(255)]
}
}
]
}
}
]
}
}
]
}
Include changelog-uri
{
"databaseChangeLog": [
{
"include": {
"file": "changelogs/v1-schema.json",
"relativeToChangelogFile": true
}
}
]
}
Validarea JSON-ului
liquibase validate --changeLogFile=db/changelog-master.json
Erori frecvente
- Virgulă lipsă — JSON este strict cu sintaxa.
- Cale greșită — căile fișierelor incluse trebuie să fie corecte.
- Obiect vs array —
databaseChangeLogeste un array, nu obiect. - Ghilimele lipsă — cheile și valorile string trebuie să fie între ghilimele duble.
FAQ
Built by the developers of Doda Browser, DodaZIP, and Durga Antivirus Pro. DodaTech tools integrate seamlessly with Liquibase for enhanced productivity and security.
← Previous
Fix Liquibase Changelog Error – Changeset Not Running
Next →
Cum să creezi un changelog SQL în Liquibase
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro