CREATE TABLE daily_activity_stats (
    id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
    activity_id BIGINT NOT NULL,
    stat_date DATE NOT NULL,
    views INT NOT NULL DEFAULT 0,
    shares INT NOT NULL DEFAULT 0,
    new_registrations INT NOT NULL DEFAULT 0,
    conversions INT NOT NULL DEFAULT 0,
    CONSTRAINT fk_activity_stats FOREIGN KEY (activity_id) REFERENCES activities(id),
    UNIQUE (activity_id, stat_date)
);
