I'm new to android app development and am creating an app that has Trips which stores Locations.
I'm getting a compile error :"trip_Id column references a foreign key but it is not part of an index. This may trigger full table scans whenever parent table is modified so you are highly advised to create an index that covers this column."
I have 2 tables: Trip & Location.
I've tried indexing the tripId and the locationId in their respective classes but it doesn't solve the issue.
A Trip has its id (PK), title, description and priority.
A Location has its locationId (PK), tripId(FK), locationName and LatLng of the place.
@Entity(tableName = "location_table",
foreignKeys = @ForeignKey(entity = Trip.class, parentColumns = "location_Id", childColumns = "trip_Id"),
indices = {@Index(value = {"locationId"}, unique = true)})
public class Location {
@PrimaryKey(autoGenerate = true)
private int locationId;
@ColumnInfo (name = "trip_Id")
private int tripId;
private String locationName;
@TypeConverters(LatLngConverter.class)
private LatLng latLng;
@Entity(tableName = "trip_table", indices = {@Index(value = {"id"}, unique = true)})
public class Trip {
@PrimaryKey(autoGenerate = true) // with each new row SQLite will automatically increment this ID so it will be unique
@ColumnInfo (name = "location_Id")
private int id;
private String title;
private String description;
private int priority;
I can't seem to find out what's wrong
