Files
drp-48/supabase/migrations/20250613105939_favourites.sql
Caspar Jojo Asaam 2219f7a3b9 fix: Added the migration of the favourite study space table
Co-Authored-By: Tadios Temesgen <tt2022@ic.ac.uk>
2025-06-13 12:05:39 +01:00

13 lines
509 B
SQL

-- Table to store users' favourite study spaces
CREATE TABLE favourite_study_spaces (
user_id uuid REFERENCES users(id) ON DELETE CASCADE,
study_space_id uuid REFERENCES study_spaces(id) ON DELETE CASCADE,
created_at timestamp with time zone DEFAULT now(),
updated_at timestamp with time zone DEFAULT now(),
PRIMARY KEY (user_id, study_space_id)
);
CREATE TRIGGER favourite_study_spaces_updated_at
AFTER UPDATE ON favourite_study_spaces
FOR EACH ROW EXECUTE FUNCTION handle_updated_at();