|
|
|
@ -2,7 +2,6 @@ package net.pokeranalytics.android.model.migrations |
|
|
|
|
|
|
|
|
|
|
|
import io.realm.DynamicRealm |
|
|
|
import io.realm.DynamicRealm |
|
|
|
import io.realm.RealmMigration |
|
|
|
import io.realm.RealmMigration |
|
|
|
import net.pokeranalytics.android.model.realm.Comment |
|
|
|
|
|
|
|
import timber.log.Timber |
|
|
|
import timber.log.Timber |
|
|
|
import java.util.* |
|
|
|
import java.util.* |
|
|
|
|
|
|
|
|
|
|
|
@ -156,18 +155,20 @@ class PokerAnalyticsMigration : RealmMigration { |
|
|
|
|
|
|
|
|
|
|
|
// Migrate to version 8 |
|
|
|
// Migrate to version 8 |
|
|
|
if (currentVersion == 7) { |
|
|
|
if (currentVersion == 7) { |
|
|
|
schema.create("Comment")?.let { |
|
|
|
schema.create("Comment")?.let { commentSchema -> |
|
|
|
it.addField("id", String::class.java).setRequired("id", true) |
|
|
|
commentSchema.addField("id", String::class.java).setRequired("id", true) |
|
|
|
it.addField("content", String::class.java) |
|
|
|
commentSchema.addPrimaryKey("id") |
|
|
|
it.addField("date", Date::class.java) |
|
|
|
commentSchema.addField("content", String::class.java).setRequired("content", true) |
|
|
|
|
|
|
|
commentSchema.addField("date", Date::class.java).setRequired("date", true) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
schema.get("Player")?.let { |
|
|
|
|
|
|
|
it.addField("summary", String::class.java).setRequired("summary", true) |
|
|
|
|
|
|
|
it.addField("color", Int::class.java).setNullable("color", true) |
|
|
|
|
|
|
|
it.addField("picture", String::class.java) |
|
|
|
|
|
|
|
it.addRealmListField("comments", commentSchema) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
schema.get("Player")?.let { |
|
|
|
|
|
|
|
it.addField("summary", String::class.java).setRequired("summary", true) |
|
|
|
|
|
|
|
it.addField("color", Int::class.java).setNullable("color", true) |
|
|
|
|
|
|
|
it.addField("picture", String::class.java) |
|
|
|
|
|
|
|
it.addRealmListField("comments", Comment::class.java) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
currentVersion++ |
|
|
|
currentVersion++ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|