quivr/scripts/20230906151400_add_notifications_table.sql
Mamadou DICKO 575d9886c5
feat: add notifications table, and push notification on upload and crawl (#1125)
* feat: add notifications table

* feat: add Notification model

* feat: add notification repositories

* feat: add upload and crawl notifications

* feat: update notification message
2023-09-07 13:22:06 +02:00

23 lines
642 B
PL/PgSQL

-- Assuming the migration name is '20230906120000_create_notifications_table'
BEGIN;
-- Create notifications table if it doesn't exist
CREATE TABLE IF NOT EXISTS notifications (
id UUID DEFAULT gen_random_uuid() PRIMARY KEY,
datetime TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
chat_id UUID REFERENCES chats(chat_id),
message TEXT,
action VARCHAR(255) NOT NULL,
status VARCHAR(255) NOT NULL
);
-- Insert migration record if it doesn't exist
INSERT INTO migrations (name)
SELECT '20230906151400_add_notifications_table'
WHERE NOT EXISTS (
SELECT 1 FROM migrations WHERE name = '20230906151400_add_notifications_table'
);
COMMIT;