Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom-dependency-tree.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ai.elimu:webapp:war:2.6.5-SNAPSHOT
ai.elimu:webapp:war:2.6.7-SNAPSHOT
+- ai.elimu:model:jar:model-2.0.97:compile
| \- com.google.code.gson:gson:jar:2.13.0:compile
| \- com.google.errorprone:error_prone_annotations:jar:2.37.0:compile
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/ai/elimu/entity/content/Letter.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
public class Letter extends Content {

@NotNull
@Size(max = 2)
@Column(length = 2)
@Size(max = 3)
@Column(length = 3)
Comment on lines +16 to +17
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Include nullable=false in @column
To enforce the @NotNull constraint at the DDL level, add nullable=false to the @Column annotation:

-  @Column(length = 3)
+  @Column(length = 3, nullable = false)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
@Size(max = 3)
@Column(length = 3)
@Size(max = 3)
@Column(length = 3, nullable = false)

private String text;

private boolean diacritic;
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/META-INF/jpa-schema-export.sql
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@
timeLastUpdate datetime,
usageCount integer,
diacritic bit not null,
text varchar(2),
text varchar(3),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Mismatch in NOT NULL constraint
The text column definition lacks a NOT NULL constraint, causing inconsistency with the migration script and @NotNull in the entity. Please update to:

-        text varchar(3),
+        text varchar(3) NOT NULL,

primary key (id)
) type=MyISAM;

Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/db/migration/2006007.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 2.6.7

ALTER TABLE `Letter` MODIFY `text` VARCHAR(3) NOT NULL;
2 changes: 1 addition & 1 deletion src/main/webapp/WEB-INF/jsp/content/letter/create.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<div class="row">
<div class="input-field col s12">
<form:label path="text" cssErrorClass="error">Text</form:label>
<form:input path="text" cssErrorClass="error" />
<form:input path="text" cssErrorClass="error" maxlength="3" />
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/WEB-INF/jsp/content/letter/edit.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<div class="row">
<div class="input-field col s12">
<form:label path="text" cssErrorClass="error">Text</form:label>
<form:input path="text" cssErrorClass="error" />
<form:input path="text" cssErrorClass="error" maxlength="3" />
</div>
</div>

Expand Down