mirror of
https://github.com/Dvorinka/Bookra.git
synced 2026-10-28 15:51:15 +00:00
activity_events records booking lifecycle transitions with the actor behind each change — staff (dashboard), customer (self-service), or system (auto-promotion). The notification dropdown leads with the real feed instead of derived recent-booking guesses. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
22 lines
876 B
SQL
22 lines
876 B
SQL
-- +goose Up
|
|
-- Per-tenant activity feed: who changed what. Actor kinds distinguish
|
|
-- dashboard users (staff), public self-service actions (customer), and
|
|
-- automatic transitions (system). Kept to booking lifecycle events in v1.
|
|
CREATE TABLE activity_events (
|
|
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
tenant_id uuid NOT NULL REFERENCES tenants(id) ON DELETE CASCADE,
|
|
actor_kind text NOT NULL DEFAULT 'staff',
|
|
actor_subject text NOT NULL DEFAULT '',
|
|
actor_name text NOT NULL DEFAULT '',
|
|
action text NOT NULL,
|
|
entity_type text NOT NULL DEFAULT 'booking',
|
|
entity_id uuid,
|
|
summary text NOT NULL DEFAULT '',
|
|
created_at timestamptz NOT NULL DEFAULT now()
|
|
);
|
|
CREATE INDEX activity_events_tenant_created_idx
|
|
ON activity_events (tenant_id, created_at DESC);
|
|
|
|
-- +goose Down
|
|
DROP TABLE IF EXISTS activity_events;
|