1
0
mirror of https://github.com/etesync/android synced 2024-12-23 07:08:16 +00:00

Journal model: add a unique constraint to journal UIDs.

Journals and services should be unique together, this wasn't there
because of an issue with requery that should now be resolved.
This commit is contained in:
Tom Hacohen 2017-05-05 16:50:52 +01:00
parent df05dd2498
commit d86edd7688

View File

@ -19,14 +19,14 @@ import io.requery.Table;
import io.requery.sql.EntityDataStore;
public class JournalModel {
// FIXME: Add unique constraint on the uid + service combination. Can't do it at the moment because requery is broken.
@Entity
@Table(name = "Journal")
@Table(name = "Journal", uniqueIndexes = "journal_unique_together")
public static abstract class Journal {
@Key
@Generated
int id;
@Index(value = "journal_unique_together")
@Column(length = 64, nullable = false)
String uid;
@ -41,6 +41,7 @@ public class JournalModel {
@Deprecated
long service;
@Index(value = "journal_unique_together")
@ForeignKey(update = ReferentialAction.CASCADE)
@ManyToOne
Service serviceModel;