feat(tools): add maintenance and meal planning tools with CRUD operations
- 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
This commit is contained in:
42
migrations/011_household_knowledge.sql
Normal file
42
migrations/011_household_knowledge.sql
Normal file
@@ -0,0 +1,42 @@
|
||||
-- Extension 1: Household Knowledge Base
|
||||
-- Stores household facts and vendor contacts (single-user, no RLS)
|
||||
|
||||
CREATE OR REPLACE FUNCTION update_updated_at_column()
|
||||
RETURNS TRIGGER AS $$
|
||||
BEGIN
|
||||
NEW.updated_at = now();
|
||||
RETURN NEW;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS household_items (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
name TEXT NOT NULL,
|
||||
category TEXT,
|
||||
location TEXT,
|
||||
details JSONB NOT NULL DEFAULT '{}',
|
||||
notes TEXT,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS household_vendors (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
name TEXT NOT NULL,
|
||||
service_type TEXT,
|
||||
phone TEXT,
|
||||
email TEXT,
|
||||
website TEXT,
|
||||
notes TEXT,
|
||||
rating INTEGER CHECK (rating >= 1 AND rating <= 5),
|
||||
last_used DATE,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_household_items_category ON household_items(category);
|
||||
CREATE INDEX IF NOT EXISTS idx_household_vendors_service ON household_vendors(service_type);
|
||||
|
||||
DROP TRIGGER IF EXISTS update_household_items_updated_at ON household_items;
|
||||
CREATE TRIGGER update_household_items_updated_at
|
||||
BEFORE UPDATE ON household_items
|
||||
FOR EACH ROW EXECUTE FUNCTION update_updated_at_column();
|
||||
Reference in New Issue
Block a user