-- Author: Hayden Hargreaves (hhargreaves2006@gmail.com)
-- Desc:   Create the user engagement table.
-- Date:   07/13/2025

BEGIN;

CREATE TABLE IF NOT EXISTS Engagements (
  Id SERIAL PRIMARY KEY NOT NULL, 
  Type E_ENGAGEMENT NOT NULL,
  Message TEXT,
  Entity INT, -- Used to map to other DB objects, recipes, users, etc...
  UserId INTEGER REFERENCES users(id), -- Can be null, when users aren't logged in
  Created TIMESTAMPTZ NOT NULL DEFAULT NOW()
);

COMMIT;
