CREATE TABLE station ( id INTEGER PRIMARY KEY, name TEXT NOT NULL, amount_people INTEGER, last_login TIMESTAMP, pw TEXT NOT NULL, lat REAL, lng REAL ); CREATE TABLE "group" ( id INTEGER PRIMARY KEY, name TEXT NOT NULL, pfadigruppe TEXT, notes TEXT, amount_people INTEGER, first_station_id INTEGER, FOREIGN KEY (first_station_id) REFERENCES station(id) ); CREATE TABLE group_station ( group_id INTEGER, station_id INTEGER, points INTEGER, notes TEXT, arrived_at TIMESTAMP, started_at TIMESTAMP, left_at TIMESTAMP, PRIMARY KEY (group_id, station_id), FOREIGN KEY (group_id) REFERENCES "group"(id), FOREIGN KEY (station_id) REFERENCES station(id) ); CREATE TABLE path ( id INTEGER PRIMARY KEY, name TEXT NOT NULL ); CREATE TABLE path_station ( path_id INTEGER, station_id INTEGER, pos INTEGER, PRIMARY KEY (path_id, station_id), FOREIGN KEY (path_id) REFERENCES path(id), FOREIGN KEY (station_id) REFERENCES station(id) );