20 lines
847 B
MySQL
20 lines
847 B
MySQL
|
|
-- ============================================
|
||
|
|
-- 此文件由 Meoo Cloud 自动生成,请勿修改
|
||
|
|
-- This file is auto-generated by Meoo Cloud, DO NOT MODIFY
|
||
|
|
-- ============================================
|
||
|
|
|
||
|
|
|
||
|
|
CREATE TABLE IF NOT EXISTS notifications (
|
||
|
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||
|
|
recipient_id UUID NOT NULL REFERENCES auth.users(id) ON DELETE CASCADE,
|
||
|
|
sender_id UUID REFERENCES auth.users(id) ON DELETE SET NULL,
|
||
|
|
sender_company_id UUID REFERENCES companies(id) ON DELETE SET NULL,
|
||
|
|
plan_id UUID REFERENCES production_plans(id) ON DELETE CASCADE,
|
||
|
|
type TEXT NOT NULL CHECK (type IN ('step_completed', 'plan_created', 'plan_updated', 'inventory_in', 'payment_pending', 'system')),
|
||
|
|
title TEXT NOT NULL,
|
||
|
|
content TEXT NOT NULL,
|
||
|
|
is_read BOOLEAN DEFAULT false,
|
||
|
|
created_at TIMESTAMPTZ DEFAULT NOW(),
|
||
|
|
read_at TIMESTAMPTZ
|
||
|
|
);
|