- Implement maintenance tool for adding, logging, and retrieving tasks - Create meals tool for managing recipes, meal plans, and shopping lists - Introduce reparse metadata tool for updating thought metadata - Add household knowledge, home maintenance, family calendar, meal planning, and professional CRM database migrations - Grant necessary permissions for new database tables
43 lines
1.6 KiB
SQL
43 lines
1.6 KiB
SQL
-- Extension 3: Family Calendar
|
|
-- Multi-person family scheduling (single-user, no RLS)
|
|
|
|
CREATE TABLE IF NOT EXISTS family_members (
|
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
name TEXT NOT NULL,
|
|
relationship TEXT,
|
|
birth_date DATE,
|
|
notes TEXT,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS activities (
|
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
family_member_id UUID REFERENCES family_members(id) ON DELETE SET NULL,
|
|
title TEXT NOT NULL,
|
|
activity_type TEXT,
|
|
day_of_week TEXT,
|
|
start_time TIME,
|
|
end_time TIME,
|
|
start_date DATE,
|
|
end_date DATE,
|
|
location TEXT,
|
|
notes TEXT,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS important_dates (
|
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
family_member_id UUID REFERENCES family_members(id) ON DELETE SET NULL,
|
|
title TEXT NOT NULL,
|
|
date_value DATE NOT NULL,
|
|
recurring_yearly BOOLEAN NOT NULL DEFAULT false,
|
|
reminder_days_before INTEGER NOT NULL DEFAULT 7,
|
|
notes TEXT,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_activities_dow ON activities(day_of_week);
|
|
CREATE INDEX IF NOT EXISTS idx_activities_member ON activities(family_member_id);
|
|
CREATE INDEX IF NOT EXISTS idx_activities_dates ON activities(start_date, end_date);
|
|
CREATE INDEX IF NOT EXISTS idx_important_dates_date ON important_dates(date_value);
|