Upsert with 2 conditions

I have a tool that keeps stats, every day for an organisation it keeps a set of data. However using the following query, it overwrites the row, even when the date changes:
const { error } = await db.from('absence_analytics').upsert({
        org_id: org_id,
        absence_count: finalized_crawl.meta.absence_count,
        unique_absences: finalized_crawl.meta.unique_absences,
        crawl_timestamp: finalized_crawl.meta.crawl_timestamp,
        date: date,
        period_1: finalized_crawl.data.period_1 as unknown as Json[]
///.. more rows
    });
Was this page helpful?