Skip to content

Commit 165d9bd

Browse files
fix: db error fix
1 parent abbb92f commit 165d9bd

File tree

3 files changed

+26
-5
lines changed

3 files changed

+26
-5
lines changed

app/schemas/org.openedx.app.room.AppDatabase/5.json

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"formatVersion": 1,
33
"database": {
44
"version": 5,
5-
"identityHash": "7ea446decde04c9c16700cb3981703c2",
5+
"identityHash": "09f6fc49a2f7a494d27f3290d7bae350",
66
"entities": [
77
{
88
"tableName": "course_discovery_table",
@@ -748,7 +748,7 @@
748748
},
749749
{
750750
"tableName": "course_enrollment_details_table",
751-
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `courseUpdates` TEXT NOT NULL, `courseHandouts` TEXT NOT NULL, `discussionUrl` TEXT NOT NULL, `hasUnmetPrerequisites` INTEGER NOT NULL, `isTooEarly` INTEGER NOT NULL, `isStaff` INTEGER NOT NULL, `auditAccessExpires` TEXT, `hasAccess` INTEGER, `errorCode` TEXT, `developerMessage` TEXT, `userMessage` TEXT, `additionalContextUserMessage` TEXT, `userFragment` TEXT, `certificateURL` TEXT, `created` TEXT, `mode` TEXT, `isActive` INTEGER NOT NULL, `upgradeDeadline` TEXT, `name` TEXT NOT NULL, `number` TEXT NOT NULL, `org` TEXT NOT NULL, `startDisplay` TEXT NOT NULL, `startType` TEXT NOT NULL, `isSelfPaced` INTEGER NOT NULL, `courseAbout` TEXT NOT NULL, `bannerImage` TEXT, `courseImage` TEXT, `courseVideo` TEXT, `image` TEXT, `facebook` TEXT NOT NULL, `twitter` TEXT NOT NULL, PRIMARY KEY(`id`))",
751+
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `courseUpdates` TEXT NOT NULL, `courseHandouts` TEXT NOT NULL, `discussionUrl` TEXT NOT NULL, `hasUnmetPrerequisites` INTEGER NOT NULL, `isTooEarly` INTEGER NOT NULL, `isStaff` INTEGER NOT NULL, `auditAccessExpires` TEXT, `hasAccess` INTEGER, `errorCode` TEXT, `developerMessage` TEXT, `userMessage` TEXT, `additionalContextUserMessage` TEXT, `userFragment` TEXT, `certificateURL` TEXT, `created` TEXT, `mode` TEXT, `isActive` INTEGER NOT NULL, `upgradeDeadline` TEXT, `name` TEXT NOT NULL, `number` TEXT NOT NULL, `org` TEXT NOT NULL, `start` INTEGER, `startDisplay` TEXT NOT NULL, `startType` TEXT NOT NULL, `end` INTEGER, `isSelfPaced` INTEGER NOT NULL, `courseAbout` TEXT NOT NULL, `bannerImage` TEXT, `courseImage` TEXT, `courseVideo` TEXT, `image` TEXT, `facebook` TEXT NOT NULL, `twitter` TEXT NOT NULL, PRIMARY KEY(`id`))",
752752
"fields": [
753753
{
754754
"fieldPath": "id",
@@ -871,6 +871,11 @@
871871
"affinity": "TEXT",
872872
"notNull": true
873873
},
874+
{
875+
"fieldPath": "courseInfoOverview.start",
876+
"columnName": "start",
877+
"affinity": "INTEGER"
878+
},
874879
{
875880
"fieldPath": "courseInfoOverview.startDisplay",
876881
"columnName": "startDisplay",
@@ -883,6 +888,11 @@
883888
"affinity": "TEXT",
884889
"notNull": true
885890
},
891+
{
892+
"fieldPath": "courseInfoOverview.end",
893+
"columnName": "end",
894+
"affinity": "INTEGER"
895+
},
886896
{
887897
"fieldPath": "courseInfoOverview.isSelfPaced",
888898
"columnName": "isSelfPaced",
@@ -1136,7 +1146,7 @@
11361146
],
11371147
"setupQueries": [
11381148
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
1139-
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '7ea446decde04c9c16700cb3981703c2')"
1149+
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '09f6fc49a2f7a494d27f3290d7bae350')"
11401150
]
11411151
}
11421152
}

core/src/main/java/org/openedx/core/data/model/room/CourseEnrollmentDetailsEntity.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ data class CourseInfoOverviewDb(
5151
val number: String,
5252
@ColumnInfo("org")
5353
val org: String,
54-
@Embedded
54+
@ColumnInfo("start")
5555
val start: Date?,
5656
@ColumnInfo("startDisplay")
5757
val startDisplay: String,
5858
@ColumnInfo("startType")
5959
val startType: String,
60-
@Embedded
60+
@ColumnInfo("end")
6161
val end: Date?,
6262
@ColumnInfo("isSelfPaced")
6363
val isSelfPaced: Boolean,

course/src/main/java/org/openedx/course/data/storage/CourseConverter.kt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,20 @@ import org.openedx.core.data.model.room.GradingPolicyDb
88
import org.openedx.core.data.model.room.SectionScoreDb
99
import org.openedx.core.data.model.room.discovery.CourseDateBlockDb
1010
import org.openedx.foundation.extension.genericType
11+
import java.util.Date
1112

1213
class CourseConverter {
1314

15+
@TypeConverter
16+
fun fromDate(value: Date?): Long? {
17+
return value?.time
18+
}
19+
20+
@TypeConverter
21+
fun toDate(value: Long?): Date? {
22+
return value?.let { Date(it) }
23+
}
24+
1425
@TypeConverter
1526
fun fromListOfString(value: List<String>): String {
1627
val json = Gson().toJson(value)

0 commit comments

Comments
 (0)