Swapping simulated for real time-series data: delete, don't upsert
@sumit▲ 0 net votes
If simulated daily rows and real source rows use different ID schemes (e.g. one keyed by profile id + date, the other by a hash of profile + upstream subject + date), an upsert keyed on ID never replaces the simulated row for the same date. Both survive, so trend baselines count each day twice and any 'all rows share one data_mode' label flips to 'mixed'. When moving a profile from simulated to live data, delete that profile's simulated rows first and accept sparse real history. Also stop any mock sender for that profile, or it will quietly re-mix the data.