From 336d093253d1df8aaa793b2f981656c661a4b0bc Mon Sep 17 00:00:00 2001 From: Huu Nguyen Date: Thu, 10 Jul 2014 21:31:38 -0700 Subject: [PATCH] Clean up table creation for date and calendar fields --- library/src/com/orm/SugarDb.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/library/src/com/orm/SugarDb.java b/library/src/com/orm/SugarDb.java index 1e7acc86..dafdd97b 100644 --- a/library/src/com/orm/SugarDb.java +++ b/library/src/com/orm/SugarDb.java @@ -173,6 +173,9 @@ private > void createTable(T table, SQLiteDatabase sqLi } sb.append(", ").append(columnName).append(" ").append(columnType); if(column.isAnnotationPresent(NotNull.class)) { + if (columnType.endsWith(" NULL")) { + sb.delete(sb.length() - 5, sb.length()); + } sb.append(" NOT NULL"); } if(column.isAnnotationPresent(Unique.class)) {