mirror of
https://github.com/wismna/DoNext.git
synced 2025-12-06 00:02:40 -05:00
Fix due date when migrating from v1
Update packages
This commit is contained in:
@@ -51,22 +51,23 @@ android {
|
|||||||
dependencies {
|
dependencies {
|
||||||
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.9.4")
|
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.9.4")
|
||||||
implementation("androidx.activity:activity-compose:1.11.0")
|
implementation("androidx.activity:activity-compose:1.11.0")
|
||||||
implementation(platform("androidx.compose:compose-bom:2025.09.01"))
|
implementation(platform("androidx.compose:compose-bom:2025.10.00"))
|
||||||
implementation("androidx.compose.ui:ui")
|
implementation("androidx.compose.ui:ui")
|
||||||
implementation("androidx.compose.ui:ui-graphics")
|
implementation("androidx.compose.ui:ui-graphics")
|
||||||
implementation("androidx.compose.ui:ui-tooling-preview")
|
implementation("androidx.compose.ui:ui-tooling-preview")
|
||||||
implementation("androidx.compose.material3:material3")
|
implementation("androidx.compose.material3:material3")
|
||||||
|
implementation("androidx.compose.material3:material3-window-size-class:1.4.0")
|
||||||
implementation("androidx.compose.material:material-icons-extended:1.7.8")
|
implementation("androidx.compose.material:material-icons-extended:1.7.8")
|
||||||
implementation("androidx.navigation:navigation-compose:2.9.5")
|
implementation("androidx.navigation:navigation-compose:2.9.5")
|
||||||
implementation("androidx.hilt:hilt-navigation-compose:1.3.0")
|
implementation("androidx.hilt:hilt-navigation-compose:1.3.0")
|
||||||
implementation("androidx.test.ext:junit-ktx:1.3.0")
|
implementation("androidx.test.ext:junit-ktx:1.3.0")
|
||||||
implementation("sh.calvin.reorderable:reorderable:3.0.0")
|
implementation("sh.calvin.reorderable:reorderable:3.0.0")
|
||||||
androidTestImplementation(platform("androidx.compose:compose-bom:2025.09.01"))
|
androidTestImplementation(platform("androidx.compose:compose-bom:2025.10.00"))
|
||||||
androidTestImplementation("androidx.compose.ui:ui-test-junit4")
|
androidTestImplementation("androidx.compose.ui:ui-test-junit4")
|
||||||
debugImplementation("androidx.compose.ui:ui-tooling")
|
debugImplementation("androidx.compose.ui:ui-tooling")
|
||||||
debugImplementation("androidx.compose.ui:ui-test-manifest")
|
debugImplementation("androidx.compose.ui:ui-test-manifest")
|
||||||
|
|
||||||
val roomVersion = "2.8.1"
|
val roomVersion = "2.8.2"
|
||||||
implementation("androidx.room:room-runtime:$roomVersion")
|
implementation("androidx.room:room-runtime:$roomVersion")
|
||||||
ksp("androidx.room:room-compiler:$roomVersion")
|
ksp("androidx.room:room-compiler:$roomVersion")
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import com.wismna.geoffroy.donext.data.local.dao.TaskListDao
|
|||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
import java.time.ZonedDateTime
|
||||||
|
|
||||||
@Database(
|
@Database(
|
||||||
entities = [TaskEntity::class, TaskListEntity::class],
|
entities = [TaskEntity::class, TaskListEntity::class],
|
||||||
@@ -40,11 +41,24 @@ abstract class AppDatabase : RoomDatabase() {
|
|||||||
db.execSQL("ALTER TABLE tasks ADD COLUMN duedate_temp INTEGER")
|
db.execSQL("ALTER TABLE tasks ADD COLUMN duedate_temp INTEGER")
|
||||||
// Populate temporary column
|
// Populate temporary column
|
||||||
db.execSQL("""
|
db.execSQL("""
|
||||||
|
WITH offset AS (
|
||||||
|
SELECT (strftime('%s', 'now', 'localtime') - strftime('%s', 'now')) / 3600.0 AS diff
|
||||||
|
)
|
||||||
UPDATE tasks
|
UPDATE tasks
|
||||||
SET duedate_temp =
|
SET duedate_temp =
|
||||||
CASE
|
CASE
|
||||||
WHEN duedate IS NULL OR duedate = '' THEN NULL
|
WHEN duedate IS NULL OR duedate = '' THEN NULL
|
||||||
ELSE (strftime('%s', duedate || 'T00:00:00Z') * 1000)
|
ELSE (
|
||||||
|
strftime(
|
||||||
|
'%s',
|
||||||
|
duedate || ' 00:00:00',
|
||||||
|
CASE
|
||||||
|
WHEN (SELECT diff FROM offset) >= 0
|
||||||
|
THEN '-' || (SELECT diff FROM offset) || ' hours'
|
||||||
|
ELSE '+' || abs((SELECT diff FROM offset)) || ' hours'
|
||||||
|
END
|
||||||
|
) * 1000
|
||||||
|
)
|
||||||
END
|
END
|
||||||
""".trimIndent())
|
""".trimIndent())
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user