maestro-bundle 1.3.1 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/package.json +1 -1
  2. package/templates/bundle-ai-agents/skills/agent-orchestration/SKILL.md +107 -41
  3. package/templates/bundle-ai-agents/skills/agent-orchestration/references/graph-patterns.md +50 -0
  4. package/templates/bundle-ai-agents/skills/agent-orchestration/references/routing-strategies.md +47 -0
  5. package/templates/bundle-ai-agents/skills/api-design/SKILL.md +125 -16
  6. package/templates/bundle-ai-agents/skills/api-design/references/pydantic-patterns.md +72 -0
  7. package/templates/bundle-ai-agents/skills/api-design/references/rest-conventions.md +51 -0
  8. package/templates/bundle-ai-agents/skills/clean-architecture/SKILL.md +113 -21
  9. package/templates/bundle-ai-agents/skills/clean-architecture/references/dependency-injection.md +60 -0
  10. package/templates/bundle-ai-agents/skills/clean-architecture/references/layer-rules.md +56 -0
  11. package/templates/bundle-ai-agents/skills/context-engineering/SKILL.md +104 -36
  12. package/templates/bundle-ai-agents/skills/context-engineering/references/compression-techniques.md +76 -0
  13. package/templates/bundle-ai-agents/skills/context-engineering/references/context-budget-calculator.md +45 -0
  14. package/templates/bundle-ai-agents/skills/database-modeling/SKILL.md +146 -19
  15. package/templates/bundle-ai-agents/skills/database-modeling/references/index-strategies.md +48 -0
  16. package/templates/bundle-ai-agents/skills/database-modeling/references/naming-conventions.md +27 -0
  17. package/templates/bundle-ai-agents/skills/docker-containerization/SKILL.md +124 -15
  18. package/templates/bundle-ai-agents/skills/docker-containerization/references/compose-patterns.md +97 -0
  19. package/templates/bundle-ai-agents/skills/docker-containerization/references/dockerfile-checklist.md +37 -0
  20. package/templates/bundle-ai-agents/skills/eval-testing/SKILL.md +113 -25
  21. package/templates/bundle-ai-agents/skills/eval-testing/references/eval-types.md +52 -0
  22. package/templates/bundle-ai-agents/skills/eval-testing/references/golden-dataset-template.md +59 -0
  23. package/templates/bundle-ai-agents/skills/memory-management/SKILL.md +112 -28
  24. package/templates/bundle-ai-agents/skills/memory-management/references/memory-tiers.md +41 -0
  25. package/templates/bundle-ai-agents/skills/memory-management/references/namespace-conventions.md +41 -0
  26. package/templates/bundle-ai-agents/skills/prompt-engineering/SKILL.md +139 -47
  27. package/templates/bundle-ai-agents/skills/prompt-engineering/references/anti-patterns.md +59 -0
  28. package/templates/bundle-ai-agents/skills/prompt-engineering/references/prompt-templates.md +75 -0
  29. package/templates/bundle-ai-agents/skills/rag-pipeline/SKILL.md +104 -27
  30. package/templates/bundle-ai-agents/skills/rag-pipeline/references/chunking-strategies.md +27 -0
  31. package/templates/bundle-ai-agents/skills/rag-pipeline/references/embedding-models.md +31 -0
  32. package/templates/bundle-ai-agents/skills/rag-pipeline/references/rag-evaluation.md +39 -0
  33. package/templates/bundle-ai-agents/skills/testing-strategy/SKILL.md +127 -18
  34. package/templates/bundle-ai-agents/skills/testing-strategy/references/fixture-patterns.md +81 -0
  35. package/templates/bundle-ai-agents/skills/testing-strategy/references/naming-conventions.md +69 -0
  36. package/templates/bundle-base/skills/branch-strategy/SKILL.md +134 -21
  37. package/templates/bundle-base/skills/branch-strategy/references/branch-rules.md +40 -0
  38. package/templates/bundle-base/skills/code-review/SKILL.md +123 -38
  39. package/templates/bundle-base/skills/code-review/references/review-checklist.md +45 -0
  40. package/templates/bundle-base/skills/commit-pattern/SKILL.md +98 -39
  41. package/templates/bundle-base/skills/commit-pattern/references/conventional-commits.md +40 -0
  42. package/templates/bundle-data-pipeline/skills/data-preprocessing/SKILL.md +110 -19
  43. package/templates/bundle-data-pipeline/skills/data-preprocessing/references/pandas-cheatsheet.md +63 -0
  44. package/templates/bundle-data-pipeline/skills/data-preprocessing/references/pandera-schemas.md +44 -0
  45. package/templates/bundle-data-pipeline/skills/docker-containerization/SKILL.md +132 -16
  46. package/templates/bundle-data-pipeline/skills/docker-containerization/references/compose-patterns.md +82 -0
  47. package/templates/bundle-data-pipeline/skills/docker-containerization/references/dockerfile-best-practices.md +57 -0
  48. package/templates/bundle-data-pipeline/skills/feature-engineering/SKILL.md +143 -45
  49. package/templates/bundle-data-pipeline/skills/feature-engineering/references/encoding-guide.md +41 -0
  50. package/templates/bundle-data-pipeline/skills/feature-engineering/references/scaling-guide.md +38 -0
  51. package/templates/bundle-data-pipeline/skills/mlops-pipeline/SKILL.md +156 -37
  52. package/templates/bundle-data-pipeline/skills/mlops-pipeline/references/mlflow-commands.md +69 -0
  53. package/templates/bundle-data-pipeline/skills/model-training/SKILL.md +152 -33
  54. package/templates/bundle-data-pipeline/skills/model-training/references/evaluation-metrics.md +52 -0
  55. package/templates/bundle-data-pipeline/skills/model-training/references/model-selection-guide.md +41 -0
  56. package/templates/bundle-data-pipeline/skills/rag-pipeline/SKILL.md +127 -39
  57. package/templates/bundle-data-pipeline/skills/rag-pipeline/references/chunking-strategies.md +51 -0
  58. package/templates/bundle-data-pipeline/skills/rag-pipeline/references/embedding-models.md +49 -0
  59. package/templates/bundle-frontend-spa/skills/authentication/SKILL.md +196 -13
  60. package/templates/bundle-frontend-spa/skills/authentication/references/jwt-security.md +41 -0
  61. package/templates/bundle-frontend-spa/skills/component-design/SKILL.md +191 -41
  62. package/templates/bundle-frontend-spa/skills/component-design/references/accessibility-checklist.md +41 -0
  63. package/templates/bundle-frontend-spa/skills/component-design/references/tailwind-patterns.md +65 -0
  64. package/templates/bundle-frontend-spa/skills/e2e-testing/SKILL.md +241 -79
  65. package/templates/bundle-frontend-spa/skills/e2e-testing/references/playwright-selectors.md +66 -0
  66. package/templates/bundle-frontend-spa/skills/e2e-testing/references/test-patterns.md +82 -0
  67. package/templates/bundle-frontend-spa/skills/integration-api/SKILL.md +221 -31
  68. package/templates/bundle-frontend-spa/skills/integration-api/references/api-patterns.md +81 -0
  69. package/templates/bundle-frontend-spa/skills/react-patterns/SKILL.md +195 -70
  70. package/templates/bundle-frontend-spa/skills/react-patterns/references/component-checklist.md +22 -0
  71. package/templates/bundle-frontend-spa/skills/react-patterns/references/hook-patterns.md +63 -0
  72. package/templates/bundle-frontend-spa/skills/responsive-layout/SKILL.md +162 -22
  73. package/templates/bundle-frontend-spa/skills/responsive-layout/references/breakpoint-guide.md +63 -0
  74. package/templates/bundle-frontend-spa/skills/state-management/SKILL.md +158 -30
  75. package/templates/bundle-frontend-spa/skills/state-management/references/react-query-config.md +64 -0
  76. package/templates/bundle-frontend-spa/skills/state-management/references/state-patterns.md +78 -0
  77. package/templates/bundle-jhipster-microservices/skills/ci-cd-pipeline/SKILL.md +135 -45
  78. package/templates/bundle-jhipster-microservices/skills/ci-cd-pipeline/references/gitlab-ci-templates.md +93 -0
  79. package/templates/bundle-jhipster-microservices/skills/clean-architecture/SKILL.md +87 -21
  80. package/templates/bundle-jhipster-microservices/skills/clean-architecture/references/layer-rules.md +78 -0
  81. package/templates/bundle-jhipster-microservices/skills/ddd-tactical/SKILL.md +94 -25
  82. package/templates/bundle-jhipster-microservices/skills/ddd-tactical/references/ddd-patterns.md +48 -0
  83. package/templates/bundle-jhipster-microservices/skills/jhipster-angular/SKILL.md +63 -21
  84. package/templates/bundle-jhipster-microservices/skills/jhipster-angular/references/angular-microservices.md +40 -0
  85. package/templates/bundle-jhipster-microservices/skills/jhipster-angular/references/angular-structure.md +59 -0
  86. package/templates/bundle-jhipster-microservices/skills/jhipster-docker-k8s/SKILL.md +125 -91
  87. package/templates/bundle-jhipster-microservices/skills/jhipster-docker-k8s/references/docker-k8s-commands.md +68 -0
  88. package/templates/bundle-jhipster-microservices/skills/jhipster-entities/SKILL.md +72 -20
  89. package/templates/bundle-jhipster-microservices/skills/jhipster-entities/references/cross-service-entities.md +36 -0
  90. package/templates/bundle-jhipster-microservices/skills/jhipster-entities/references/jdl-types.md +56 -0
  91. package/templates/bundle-jhipster-microservices/skills/jhipster-gateway/SKILL.md +80 -8
  92. package/templates/bundle-jhipster-microservices/skills/jhipster-gateway/references/gateway-config.md +43 -0
  93. package/templates/bundle-jhipster-microservices/skills/jhipster-kafka/SKILL.md +115 -22
  94. package/templates/bundle-jhipster-microservices/skills/jhipster-kafka/references/kafka-events.md +39 -0
  95. package/templates/bundle-jhipster-microservices/skills/jhipster-registry/SKILL.md +92 -23
  96. package/templates/bundle-jhipster-microservices/skills/jhipster-registry/references/consul-config.md +61 -0
  97. package/templates/bundle-jhipster-microservices/skills/jhipster-service/SKILL.md +81 -18
  98. package/templates/bundle-jhipster-microservices/skills/jhipster-service/references/service-patterns.md +40 -0
  99. package/templates/bundle-jhipster-microservices/skills/testing-strategy/SKILL.md +101 -20
  100. package/templates/bundle-jhipster-microservices/skills/testing-strategy/references/test-naming.md +55 -0
  101. package/templates/bundle-jhipster-monorepo/skills/clean-architecture/SKILL.md +87 -21
  102. package/templates/bundle-jhipster-monorepo/skills/clean-architecture/references/layer-rules.md +78 -0
  103. package/templates/bundle-jhipster-monorepo/skills/ddd-tactical/SKILL.md +94 -25
  104. package/templates/bundle-jhipster-monorepo/skills/ddd-tactical/references/ddd-patterns.md +48 -0
  105. package/templates/bundle-jhipster-monorepo/skills/jhipster-angular/SKILL.md +99 -52
  106. package/templates/bundle-jhipster-monorepo/skills/jhipster-angular/references/angular-structure.md +59 -0
  107. package/templates/bundle-jhipster-monorepo/skills/jhipster-entities/SKILL.md +89 -36
  108. package/templates/bundle-jhipster-monorepo/skills/jhipster-entities/references/jdl-types.md +56 -0
  109. package/templates/bundle-jhipster-monorepo/skills/jhipster-liquibase/SKILL.md +123 -23
  110. package/templates/bundle-jhipster-monorepo/skills/jhipster-liquibase/references/liquibase-operations.md +95 -0
  111. package/templates/bundle-jhipster-monorepo/skills/jhipster-security/SKILL.md +106 -19
  112. package/templates/bundle-jhipster-monorepo/skills/jhipster-security/references/security-checklist.md +47 -0
  113. package/templates/bundle-jhipster-monorepo/skills/jhipster-spring/SKILL.md +84 -16
  114. package/templates/bundle-jhipster-monorepo/skills/jhipster-spring/references/spring-layers.md +41 -0
  115. package/templates/bundle-jhipster-monorepo/skills/testing-strategy/SKILL.md +101 -20
  116. package/templates/bundle-jhipster-monorepo/skills/testing-strategy/references/test-naming.md +55 -0
@@ -1,49 +1,49 @@
1
1
  ---
2
2
  name: jhipster-entities
3
- description: Criar e gerenciar entidades JHipster com JDL, relationships, enums, validações e geração de código. Use quando precisar criar entidades, definir modelo de dados, ou gerar código com JHipster.
3
+ description: Create and manage JHipster entities with JDL, relationships, enums, validations, and code generation. Use when creating entities, defining data models, generating CRUD, or writing JDL files.
4
+ version: 1.0.0
5
+ author: Maestro
4
6
  ---
5
7
 
6
8
  # JHipster Entities
7
9
 
8
- ## Fluxo
10
+ Create and manage JHipster entities using JDL (JHipster Domain Language) with relationships, validations, and DDD enrichment.
9
11
 
10
- ```
11
- 1. Definir entidade no JDL
12
- 2. Rodar jhipster import-jdl
13
- 3. Enriquecer entidade gerada com comportamento DDD
14
- 4. Ajustar Liquibase changeset se necessário
15
- 5. Criar/ajustar testes
16
- ```
12
+ ## When to Use
13
+ - When creating new entities or data models
14
+ - When defining relationships between entities
15
+ - When generating CRUD code from JDL
16
+ - When enriching generated entities with business behavior (DDD)
17
+ - When updating existing entity definitions
17
18
 
18
- ## JDL — Sintaxe
19
+ ## Available Operations
20
+ 1. Define entities in JDL with types and validations
21
+ 2. Define relationships (OneToMany, ManyToMany, OneToOne)
22
+ 3. Generate code with `jhipster import-jdl`
23
+ 4. Enrich generated entities with domain behavior
24
+ 5. Create/update enums
19
25
 
20
- ```jdl
21
- entity NomeDaEntidade {
22
- campo TipoDoCampo validacao
23
- }
24
- ```
26
+ ## Multi-Step Workflow
27
+
28
+ ### Step 1: Define Entity in JDL
29
+ Create or edit the JDL file with entity definitions.
25
30
 
26
- ### Tipos disponíveis
27
- | Tipo JDL | Java | DB |
31
+ Available types:
32
+ | JDL Type | Java Type | DB Column |
28
33
  |---|---|---|
29
34
  | String | String | varchar(255) |
30
35
  | Integer | Integer | integer |
31
36
  | Long | Long | bigint |
32
- | Float | Float | float |
33
- | Double | Double | double |
34
37
  | BigDecimal | BigDecimal | decimal |
35
38
  | Boolean | Boolean | boolean |
36
39
  | LocalDate | LocalDate | date |
37
40
  | Instant | Instant | timestamp |
38
41
  | ZonedDateTime | ZonedDateTime | timestamp |
39
- | Duration | Duration | bigint |
40
42
  | UUID | UUID | uuid |
41
- | Blob | byte[] | blob |
42
- | AnyBlob | byte[] | blob |
43
- | ImageBlob | byte[] | blob |
43
+ | Blob/AnyBlob/ImageBlob | byte[] | blob |
44
44
  | TextBlob | String | clob |
45
45
 
46
- ### Validações
46
+ Example with validations:
47
47
  ```jdl
48
48
  entity Product {
49
49
  name String required minlength(3) maxlength(100)
@@ -54,7 +54,7 @@ entity Product {
54
54
  }
55
55
  ```
56
56
 
57
- ### Relationships
57
+ ### Step 2: Define Relationships
58
58
  ```jdl
59
59
  relationship OneToMany {
60
60
  Department{employees} to Employee{department(name) required}
@@ -69,7 +69,7 @@ relationship OneToOne {
69
69
  }
70
70
  ```
71
71
 
72
- ### Enums
72
+ ### Step 3: Define Enums
73
73
  ```jdl
74
74
  enum Status {
75
75
  ACTIVE("Ativo"),
@@ -78,26 +78,31 @@ enum Status {
78
78
  }
79
79
  ```
80
80
 
81
- ## Gerar código
81
+ ### Step 4: Generate Code
82
82
 
83
83
  ```bash
84
- # Gerar a partir do JDL
84
+ # Generate from JDL (recommended)
85
85
  jhipster import-jdl jhipster-jdl.jdl
86
86
 
87
- # Gerar entidade individual
87
+ # Generate individual entity interactively
88
88
  jhipster entity Demand
89
- ```
90
89
 
91
- ## Enriquecer com DDD
90
+ # Verify generated files
91
+ ls src/main/java/com/myapp/domain/
92
+ ls src/main/java/com/myapp/web/rest/
93
+ ls src/main/java/com/myapp/repository/
94
+ ls src/main/resources/config/liquibase/changelog/
95
+ ```
92
96
 
93
- Após gerar, adicionar comportamento à entidade:
97
+ ### Step 5: Enrich with DDD Behavior
98
+ After generation, add rich domain behavior to the entity:
94
99
 
95
100
  ```java
96
101
  @Entity
97
102
  @Table(name = "demand")
98
103
  public class Demand implements Serializable {
99
104
 
100
- // Campos gerados pelo JHipster (manter)
105
+ // Generated fields (keep as-is)
101
106
  @Id
102
107
  @GeneratedValue(strategy = GenerationType.SEQUENCE)
103
108
  private Long id;
@@ -113,10 +118,10 @@ public class Demand implements Serializable {
113
118
  @OneToMany(mappedBy = "demand", cascade = CascadeType.ALL, orphanRemoval = true)
114
119
  private List<Task> tasks = new ArrayList<>();
115
120
 
116
- // ADICIONAR comportamento rico
121
+ // ADD -- rich behavior
117
122
  public void addTask(Task task) {
118
123
  if (this.tasks.size() >= 20) {
119
- throw new BusinessException("Máximo 20 tasks por demanda");
124
+ throw new BusinessException("Maximo 20 tasks por demanda");
120
125
  }
121
126
  this.tasks.add(task);
122
127
  task.setDemand(this);
@@ -133,9 +138,57 @@ public class Demand implements Serializable {
133
138
 
134
139
  public void complete() {
135
140
  if (!isCompletable()) {
136
- throw new BusinessException("Nem todas as tasks foram concluídas");
141
+ throw new BusinessException("Nem todas as tasks foram concluidas");
137
142
  }
138
143
  this.status = DemandStatus.COMPLETED;
139
144
  }
140
145
  }
141
146
  ```
147
+
148
+ ### Step 6: Adjust Liquibase and Tests
149
+
150
+ ```bash
151
+ # Verify generated changelog
152
+ cat src/main/resources/config/liquibase/changelog/*_added_entity_*.xml
153
+
154
+ # Run tests to verify generation
155
+ ./mvnw test -Dtest="*DemandResourceIT"
156
+
157
+ # Run the app to verify
158
+ ./mvnw spring-boot:run
159
+ ```
160
+
161
+ ## Resources
162
+ - `references/jdl-types.md` - Complete JDL type reference and validation options
163
+
164
+ ## Examples
165
+ ### Example 1: Create a New Entity
166
+ User asks: "Create a Product entity with name, price, and SKU"
167
+ Response approach:
168
+ 1. Write JDL definition with proper types and validations
169
+ 2. Run `jhipster import-jdl jhipster-jdl.jdl`
170
+ 3. Verify generated files in domain/, repository/, web/rest/
171
+ 4. Add any domain behavior needed
172
+ 5. Run `./mvnw test` to verify
173
+
174
+ ### Example 2: Add Relationship Between Entities
175
+ User asks: "A Department has many Employees"
176
+ Response approach:
177
+ 1. Add `relationship OneToMany { Department{employees} to Employee{department required} }` to JDL
178
+ 2. Regenerate with `jhipster import-jdl jhipster-jdl.jdl`
179
+ 3. Check generated foreign keys in Liquibase changelog
180
+ 4. Run `./mvnw test`
181
+
182
+ ### Example 3: Enrich Entity with Business Rules
183
+ User asks: "Add a rule that a demand cannot have more than 20 tasks"
184
+ Response approach:
185
+ 1. Open the Demand entity class
186
+ 2. Add `addTask()` method with the invariant check
187
+ 3. Add corresponding unit test
188
+ 4. Run `./mvnw test`
189
+
190
+ ## Notes
191
+ - Always run `jhipster import-jdl` to regenerate after JDL changes
192
+ - Mark custom code clearly to preserve during regeneration
193
+ - Liquibase changelogs are auto-generated -- review before running
194
+ - Use `references/jdl-types.md` for the complete type reference
@@ -0,0 +1,56 @@
1
+ # JDL Types Reference
2
+
3
+ ## Field Types
4
+ | JDL Type | Java | DB | Notes |
5
+ |---|---|---|---|
6
+ | String | String | varchar(255) | Default max 255 |
7
+ | Integer | Integer | integer | 32-bit |
8
+ | Long | Long | bigint | 64-bit |
9
+ | Float | Float | float | Single precision |
10
+ | Double | Double | double | Double precision |
11
+ | BigDecimal | BigDecimal | decimal | Exact precision |
12
+ | Boolean | Boolean | boolean | |
13
+ | LocalDate | LocalDate | date | Date only |
14
+ | Instant | Instant | timestamp | UTC timestamp |
15
+ | ZonedDateTime | ZonedDateTime | timestamp | With timezone |
16
+ | Duration | Duration | bigint | Duration in nanos |
17
+ | UUID | UUID | uuid | Unique identifier |
18
+ | Blob | byte[] | blob | Binary data |
19
+ | AnyBlob | byte[] | blob | Any binary |
20
+ | ImageBlob | byte[] | blob | Image with content type |
21
+ | TextBlob | String | clob | Large text |
22
+
23
+ ## Validations
24
+ | Validation | Applies to | Example |
25
+ |---|---|---|
26
+ | `required` | All | `name String required` |
27
+ | `minlength(n)` | String | `name String minlength(3)` |
28
+ | `maxlength(n)` | String | `name String maxlength(100)` |
29
+ | `min(n)` | Numeric | `price BigDecimal min(0)` |
30
+ | `max(n)` | Numeric | `quantity Integer max(1000)` |
31
+ | `pattern(regex)` | String | `sku String pattern(/^[A-Z]{3}-[0-9]{4}$/)` |
32
+ | `unique` | All | `email String unique` |
33
+
34
+ ## Relationship Types
35
+ ```jdl
36
+ relationship OneToMany {
37
+ Owner{children} to Child{owner(displayField) required}
38
+ }
39
+ relationship ManyToMany {
40
+ A{bs} to B{as}
41
+ }
42
+ relationship OneToOne {
43
+ A{b} to B with jpaDerivedIdentifier
44
+ }
45
+ relationship ManyToOne {
46
+ Child{parent(name)} to Parent
47
+ }
48
+ ```
49
+
50
+ ## Enum Definition
51
+ ```jdl
52
+ enum Status {
53
+ ACTIVE("Active"),
54
+ INACTIVE("Inactive")
55
+ }
56
+ ```
@@ -1,28 +1,55 @@
1
1
  ---
2
2
  name: jhipster-liquibase
3
- description: Gerenciar migrations de banco com Liquibase no JHipster. Use quando precisar criar tabelas, alterar schema, adicionar colunas, ou criar índices.
3
+ description: Manage database migrations with Liquibase in JHipster. Use when creating tables, altering schema, adding columns, creating indexes, or managing database changesets.
4
+ version: 1.0.0
5
+ author: Maestro
4
6
  ---
5
7
 
6
- # Liquibase no JHipster
8
+ # JHipster Liquibase
7
9
 
8
- ## Estrutura
10
+ Manage database schema migrations using Liquibase in JHipster projects, including creating tables, adding columns, indexes, and foreign keys.
11
+
12
+ ## When to Use
13
+ - When creating new database tables
14
+ - When adding or modifying columns
15
+ - When creating indexes or foreign keys
16
+ - When reviewing or fixing auto-generated changesets
17
+ - When rolling back database changes
18
+
19
+ ## Available Operations
20
+ 1. Create a new table changeset
21
+ 2. Add columns to existing tables
22
+ 3. Create indexes and foreign keys
23
+ 4. Preview SQL before execution
24
+ 5. Rollback changesets
25
+
26
+ ## Multi-Step Workflow
27
+
28
+ ### Step 1: Understand the Structure
9
29
 
10
30
  ```
11
31
  src/main/resources/config/liquibase/
12
- ├── master.xml # Arquivo principal (lista todos os changelogs)
13
- ├── changelog/
14
- │ ├── 00000000000000_initial_schema.xml
15
- │ ├── 20260327100000_added_entity_Demand.xml
16
- │ ├── 20260327100100_added_entity_Task.xml
17
- │ └── 20260327120000_added_column_priority.xml
18
- └── data/
19
- ├── authority.csv # Dados iniciais
20
- └── user.csv
32
+ master.xml # Main file (lists all changelogs)
33
+ changelog/
34
+ 00000000000000_initial_schema.xml
35
+ 20260327100000_added_entity_Demand.xml
36
+ 20260327100100_added_entity_Task.xml
37
+ data/
38
+ authority.csv # Initial data
39
+ user.csv
40
+ ```
41
+
42
+ ```bash
43
+ # View existing changelogs
44
+ ls src/main/resources/config/liquibase/changelog/
45
+
46
+ # View master.xml includes
47
+ cat src/main/resources/config/liquibase/master.xml
21
48
  ```
22
49
 
23
- ## Criar changeset
50
+ ### Step 2: Create a Changeset
24
51
 
25
- ### Nova tabela
52
+ **New table:**
26
53
  ```xml
27
54
  <changeSet id="20260327-1" author="dev">
28
55
  <createTable tableName="demand">
@@ -50,7 +77,7 @@ src/main/resources/config/liquibase/
50
77
  </changeSet>
51
78
  ```
52
79
 
53
- ### Adicionar coluna
80
+ **Add column:**
54
81
  ```xml
55
82
  <changeSet id="20260327-2" author="dev">
56
83
  <addColumn tableName="demand">
@@ -61,7 +88,7 @@ src/main/resources/config/liquibase/
61
88
  </changeSet>
62
89
  ```
63
90
 
64
- ### Foreign key
91
+ **Foreign key:**
65
92
  ```xml
66
93
  <changeSet id="20260327-3" author="dev">
67
94
  <addForeignKeyConstraint
@@ -73,11 +100,9 @@ src/main/resources/config/liquibase/
73
100
  </changeSet>
74
101
  ```
75
102
 
76
- ## Regras
103
+ ### Step 3: Add Rollback
77
104
 
78
- - IDs de changeset: `YYYYMMDD-N` (data + sequencial)
79
- - Nunca modificar changeset já executado em produção
80
- - Sempre adicionar rollback:
105
+ Always include rollback instructions:
81
106
  ```xml
82
107
  <changeSet id="20260327-1" author="dev">
83
108
  <addColumn tableName="demand">
@@ -88,8 +113,83 @@ src/main/resources/config/liquibase/
88
113
  </rollback>
89
114
  </changeSet>
90
115
  ```
91
- - Testar migration com `./mvnw liquibase:updateSQL` antes de rodar
92
- - Registrar no `master.xml`:
116
+
117
+ ### Step 4: Register in master.xml
118
+
93
119
  ```xml
94
- <include file="config/liquibase/changelog/20260327120000_added_column_priority.xml" relativeToChangelogFile="false"/>
120
+ <include file="config/liquibase/changelog/20260327120000_added_column_priority.xml"
121
+ relativeToChangelogFile="false"/>
122
+ ```
123
+
124
+ ### Step 5: Preview and Apply
125
+
126
+ ```bash
127
+ # Preview SQL without executing
128
+ ./mvnw liquibase:updateSQL
129
+
130
+ # Apply migrations
131
+ ./mvnw liquibase:update
132
+
133
+ # Check migration status
134
+ ./mvnw liquibase:status
135
+
136
+ # Rollback last changeset
137
+ ./mvnw liquibase:rollbackCount -Dliquibase.rollbackCount=1
138
+
139
+ # Run the application (auto-applies pending migrations)
140
+ ./mvnw spring-boot:run
141
+
142
+ # Verify database state
143
+ ./mvnw liquibase:status
95
144
  ```
145
+
146
+ ### Step 6: Verify
147
+
148
+ ```bash
149
+ # Run integration tests that validate schema
150
+ ./mvnw test -Dtest="*RepositoryIT,*ResourceIT"
151
+
152
+ # Check for migration issues
153
+ ./mvnw liquibase:validate
154
+ ```
155
+
156
+ ## Resources
157
+ - `references/liquibase-operations.md` - Complete reference of Liquibase XML operations
158
+
159
+ ## Examples
160
+ ### Example 1: Create a New Entity Table
161
+ User asks: "Create a products table with name, price, and SKU"
162
+ Response approach:
163
+ 1. Create changelog file `YYYYMMDD_added_entity_Product.xml`
164
+ 2. Define `createTable` with columns and constraints
165
+ 3. Add index on frequently queried columns
166
+ 4. Add rollback with `dropTable`
167
+ 5. Register in `master.xml`
168
+ 6. Run `./mvnw liquibase:updateSQL` to preview
169
+ 7. Run `./mvnw spring-boot:run` to apply
170
+
171
+ ### Example 2: Add Column to Existing Table
172
+ User asks: "Add a priority column to the demand table"
173
+ Response approach:
174
+ 1. Create changelog file `YYYYMMDD_added_column_priority.xml`
175
+ 2. Use `addColumn` with type and constraints
176
+ 3. Add rollback with `dropColumn`
177
+ 4. Register in `master.xml`
178
+ 5. Preview with `./mvnw liquibase:updateSQL`
179
+ 6. Apply by running the app
180
+
181
+ ### Example 3: Fix a Migration Issue
182
+ User asks: "The migration is failing on startup"
183
+ Response approach:
184
+ 1. Check error in application logs
185
+ 2. Run `./mvnw liquibase:status` to see pending changesets
186
+ 3. Run `./mvnw liquibase:validate` to check for issues
187
+ 4. If needed, rollback with `./mvnw liquibase:rollbackCount`
188
+ 5. Fix the changeset and reapply
189
+
190
+ ## Notes
191
+ - Changeset IDs follow format: `YYYYMMDD-N` (date + sequential number)
192
+ - NEVER modify a changeset already executed in production
193
+ - Always add rollback instructions to changesets
194
+ - Preview SQL with `./mvnw liquibase:updateSQL` before applying
195
+ - JHipster auto-generates changesets from JDL -- review before running
@@ -0,0 +1,95 @@
1
+ # Liquibase Operations Reference
2
+
3
+ ## Table Operations
4
+ ```xml
5
+ <!-- Create table -->
6
+ <createTable tableName="name">
7
+ <column name="id" type="bigint" autoIncrement="true">
8
+ <constraints primaryKey="true" nullable="false"/>
9
+ </column>
10
+ <column name="field" type="varchar(255)">
11
+ <constraints nullable="false"/>
12
+ </column>
13
+ </createTable>
14
+
15
+ <!-- Drop table -->
16
+ <dropTable tableName="name"/>
17
+ ```
18
+
19
+ ## Column Operations
20
+ ```xml
21
+ <!-- Add column -->
22
+ <addColumn tableName="name">
23
+ <column name="new_col" type="varchar(100)">
24
+ <constraints nullable="false"/>
25
+ </column>
26
+ </addColumn>
27
+
28
+ <!-- Drop column -->
29
+ <dropColumn tableName="name" columnName="col"/>
30
+
31
+ <!-- Modify column type -->
32
+ <modifyDataType tableName="name" columnName="col" newDataType="varchar(500)"/>
33
+
34
+ <!-- Rename column -->
35
+ <renameColumn tableName="name" oldColumnName="old" newColumnName="new" columnDataType="varchar(255)"/>
36
+
37
+ <!-- Add default value -->
38
+ <addDefaultValue tableName="name" columnName="col" defaultValue="ACTIVE"/>
39
+ ```
40
+
41
+ ## Constraint Operations
42
+ ```xml
43
+ <!-- Add NOT NULL -->
44
+ <addNotNullConstraint tableName="name" columnName="col" columnDataType="varchar(255)"/>
45
+
46
+ <!-- Add UNIQUE -->
47
+ <addUniqueConstraint tableName="name" columnNames="col1,col2" constraintName="ux_name_cols"/>
48
+
49
+ <!-- Add Foreign Key -->
50
+ <addForeignKeyConstraint
51
+ baseTableName="child" baseColumnNames="parent_id"
52
+ constraintName="fk_child_parent"
53
+ referencedTableName="parent" referencedColumnNames="id"/>
54
+ ```
55
+
56
+ ## Index Operations
57
+ ```xml
58
+ <!-- Create index -->
59
+ <createIndex indexName="idx_table_col" tableName="name">
60
+ <column name="col"/>
61
+ </createIndex>
62
+
63
+ <!-- Composite index -->
64
+ <createIndex indexName="idx_table_cols" tableName="name">
65
+ <column name="col1"/>
66
+ <column name="col2"/>
67
+ </createIndex>
68
+
69
+ <!-- Drop index -->
70
+ <dropIndex tableName="name" indexName="idx_table_col"/>
71
+ ```
72
+
73
+ ## Data Operations
74
+ ```xml
75
+ <!-- Insert data -->
76
+ <insert tableName="name">
77
+ <column name="id" value="1"/>
78
+ <column name="name" value="Admin"/>
79
+ </insert>
80
+
81
+ <!-- Load from CSV -->
82
+ <loadData file="config/liquibase/data/entity.csv" tableName="name" separator=";">
83
+ <column name="id" type="numeric"/>
84
+ <column name="name" type="string"/>
85
+ </loadData>
86
+ ```
87
+
88
+ ## Maven Commands
89
+ ```bash
90
+ ./mvnw liquibase:updateSQL # Preview SQL
91
+ ./mvnw liquibase:update # Apply migrations
92
+ ./mvnw liquibase:status # Check pending
93
+ ./mvnw liquibase:validate # Validate changelogs
94
+ ./mvnw liquibase:rollbackCount -Dliquibase.rollbackCount=1 # Rollback
95
+ ```