Skip to content
This repository was archived by the owner on Apr 21, 2026. It is now read-only.

Commit d2bb097

Browse files
bpamiriclaude
andcommitted
Fix integer-to-boolean comparisons for CockroachDB compatibility
CockroachDB enforces strict boolean typing and rejects integer 1/0 for boolean columns. Changed all = 1/= 0 comparisons and assignments to = true/= false across controllers and models. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 3fa69e2 commit d2bb097

7 files changed

Lines changed: 13 additions & 13 deletions

File tree

app/controllers/admin/AdminController.cfc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ component extends="app.Controllers.Controller" {
381381
}
382382
try {
383383
blog.statusId = 7;
384-
blog.is_deleted = 1;
384+
blog.is_deleted = true;
385385
blog.deletedAt = now();
386386
blog.deletedBy = GetSignedInUserId();
387387
blog.save();

app/controllers/admin/UserController.cfc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,14 +215,14 @@ component extends="app.Controllers.Controller" {
215215
* Count active users
216216
*/
217217
private function countActive() {
218-
return model("User").count(where="status = 1");
218+
return model("User").count(where="status = true");
219219
}
220220

221221
/**
222222
* Count pending users
223223
*/
224224
private function countPending() {
225-
return model("User").count(where="status = 0");
225+
return model("User").count(where="status = false");
226226
}
227227

228228
/**

app/controllers/web/AuthController.cfc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ component extends="app.Controllers.Controller" {
659659
var newToken = model("UserToken").new();
660660
newToken.token = verificationToken;
661661
newToken.user_id = newUser.id;
662-
newToken.status = 0; // Not verified
662+
newToken.status = false; // Not verified
663663
newToken.save();
664664
// Send verification email
665665
if(sendVerificationEmail(newUser.email, verificationToken)){
@@ -797,15 +797,15 @@ component extends="app.Controllers.Controller" {
797797

798798
try {
799799
// Check if user already has a verification token
800-
var existingToken = model("UserToken").findOne(where="user_id='#user.id#' AND status='0'");
800+
var existingToken = model("UserToken").findOne(where="user_id='#user.id#' AND status=false");
801801

802802
if (!isObject(existingToken)) {
803803
// Generate a new verification token
804804
var verificationToken = Hash(createUUID());
805805
var newToken = model("UserToken").new();
806806
newToken.token = verificationToken;
807807
newToken.user_id = user.id;
808-
newToken.status = 0; // Not verified
808+
newToken.status = false; // Not verified
809809
newToken.save();
810810
} else {
811811
var verificationToken = existingToken.token;

app/controllers/web/BlogController.cfc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ component extends="app.Controllers.Controller" {
744744
public function commentsFeed() {
745745
// Get recent comments with related blog post
746746
comments = model("Comment").findAll(
747-
where = "isPublished = 1",
747+
where = "isPublished = true",
748748
include = "Blog",
749749
order = "createdAt DESC",
750750
limit = 20,
@@ -1250,7 +1250,7 @@ component extends="app.Controllers.Controller" {
12501250
}
12511251

12521252
function getAllCommentsByBlogid(required numeric id) {
1253-
var comments = model("Comment").findAll(include="User", where="isPublished = 1 AND blogid = '#arguments.id#' AND commentParentId ISNULL ", cache=5);
1253+
var comments = model("Comment").findAll(include="User", where="isPublished = true AND blogid = '#arguments.id#' AND commentParentId ISNULL ", cache=5);
12541254

12551255
return comments;
12561256
}
@@ -1300,7 +1300,7 @@ component extends="app.Controllers.Controller" {
13001300
response = saveComment(params);
13011301
}
13021302
if(structKeyExists(response, "Id")){
1303-
comments = commentModel.findAll(include="User", where="id ='#response.Id#' AND isPublished = 1");
1303+
comments = commentModel.findAll(include="User", where="id ='#response.Id#' AND isPublished = true");
13041304
renderPartial(partial="partials/comment");
13051305
}
13061306
} catch (any e) {

app/controllers/web/TestimonialController.cfc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ component extends="app.Controllers.Controller" {
1313
*/
1414
public void function publicList() {
1515
testimonials = model("Testimonial").findAll(
16-
where="isApproved = 1",
16+
where="isApproved = true",
1717
include="User",
1818
order="createdAt DESC"
1919
);

app/models/Comment.cfc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ component extends="app.Models.Model" {
3030

3131
// fetch all comments
3232
public function getAllComments(){
33-
var comments = findAll(where='isPublished = 1', include="User");
33+
var comments = findAll(where='isPublished = true', include="User");
3434
return comments;
3535
}
3636
}

app/models/Testimonial.cfc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ component extends="app.Models.Model" {
5050

5151
mergedOptions.append(options, true);
5252

53-
conditions = "isApproved = 1 AND displayPermission = 1";
53+
conditions = "isApproved = true AND displayPermission = true";
5454
if (mergedOptions.onlyFeatured) {
55-
conditions &= " AND isFeatured = 1";
55+
conditions &= " AND isFeatured = true";
5656
}
5757

5858
return model("Testimonial").findAll(

0 commit comments

Comments
 (0)