Potion/internal/infrastructure/database/migrations/007_create_engagement_table.sql
Hayden Hargreaves d2835c636c (DB/FEAT): Began the implementation of the user engagement!
The database requirements have been added, as well as the service/repo
architecture. A few small functions have been created, but the system is
not complete by any means. More work is required to mark this task
complete.
2025-07-13 21:34:54 -07:00

17 lines
468 B
PL/PgSQL

-- 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;