I am working on an Android app that uses SQLite, in which I have two tables: tracks and waypoints. Here, a track can have many waypoints, but a waypoint is assigned to only 1 track.
Waypoints table have a column called "trackidfk" which inserts the track_ID once a track is made, but no Foreign Key constraints are set on this column.
So, what should I do, if I want to delete a track and all the assigned waypoints along with it? Please suggest.
Heres my code to create the waypoints table:
public void onCreate(SQLiteDatabase db) {
db.execSQL( "CREATE TABLE " + TABLE_NAME
+ " ("
+ _ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
+ LONGITUDE + " INTEGER,"
+ LATITUDE + " INTEGER,"
+ TIME + " INTEGER,"
+ TRACK_ID_FK + " INTEGER"
+ " );"
);
...
}