Skip to content
This repository was archived by the owner on Feb 4, 2025. It is now read-only.

Commit 04da183

Browse files
author
Thomas Horta
committed
Add ON CONFLICT statement to Prompts migration
This avoids crashes when, for some reason, the Prompts table has multiple entries for the same day. There's no harm dropping duplicate entries as we fetch prompts and overwrite frequently.
1 parent b61e04f commit 04da183

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

fluxc/src/main/java/org/wordpress/android/fluxc/persistence/WPAndroidDatabase.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,9 @@ abstract class WPAndroidDatabase : RoomDatabase() {
338338
"respondentsCount, attribution, respondentsAvatars, answeredLink) " +
339339
"SELECT id, siteLocalId, text, date, isAnswered, " +
340340
"respondentsCount, attribution, respondentsAvatars, " +
341-
"'$tagPrefix' || id FROM BloggingPrompts"
341+
"'$tagPrefix' || id FROM BloggingPrompts " +
342+
"WHERE true " +
343+
"ON CONFLICT DO NOTHING"
342344
)
343345

344346
execSQL("DROP TABLE `BloggingPrompts`")

0 commit comments

Comments
 (0)