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.
pull/14/head
Tom Hacohen 8 years ago
parent df05dd2498
commit d86edd7688

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

Loading…
Cancel
Save