CREATE TABLE location_history (
    id INTEGER PRIMARY KEY NOT NULL,
    timestamp BIGINT NOT NULL,
    latitude REAL NOT NULL,
    longitude REAL NOT NULL,
    accuracy INTEGER,
    activity TEXT,
    activity_confidence INTEGER,
    place_name TEXT,
    place_category TEXT,
    embedding BLOB,
    created_at BIGINT NOT NULL,
    source_file TEXT,
    UNIQUE(timestamp, latitude, longitude)
);

CREATE INDEX idx_location_timestamp ON location_history(timestamp);
CREATE INDEX idx_location_coords ON location_history(latitude, longitude);
CREATE INDEX idx_location_activity ON location_history(activity);
